我想将工作簿从其他路径复制到我的活动工作簿,但是当我在下面运行时显示错误


Option Explicit
Sub Test()
    Dim ABC As Workbook
    Dim XYZ As ThisWorkbook
    With Application
        .ScreenUpdating = False
        .EnableEvents = False
        .DisplayAlerts = False
    End With
    Set XYZ = ThisWorkbook
    Set ABC = Workbooks.Open("F:TestABC.csv")
    With ABC
        .Copy After:=XYZ.Sheets(XYZ.Sheets.Count)
        .Close False
    End With
    With Application
        .ScreenUpdating = True
        .EnableEvents = True
        .DisplayAlerts = True
    End With
End Sub

与美国广播公司 .复制后:=XYZ。片材(XYZ.表数) .关闭假结尾为

在上面的行中,ABC是一个工作簿,ABC工作簿的工作表引用在哪里?

也使用工作表引用。

With ABC.Sheets("MySheet")

With ABC.Sheets(1)

最新更新