谁能帮我?我有这个语法
Dim oExcel As Variant
Dim oWB As Variant
'Set oWB = CreateObject("Object.Workbook")
Set oExcel = CreateObject("Excel.Application")
Set oWB = oExcel.Workbooks.Open("Z:\MPR\Maret 2017\31 - 03 -2017\DF\PAL - DF.xlsx")
oWB.Sheets(1).select
Dim oNumRow As Integer
'oNumRow = oWB.Sheets(1).UsedRange.Count
With oWB
oNumRow = oWB.Sheets(1).Cells(oWB.Sheets(1).Rows.Count, "A").End(xlUp).row 'error
End With
oNumRow = oWB.Sheets(1).Cells(oWB.Sheets(1).Rows.Count, 1).End.row 'error
oNumRow = oWB.Sheets(1).Range("A1", oWB.Sheets(1).Range("A1").End(xlDown).row).Rows.Count'error
如果我将其更改 Dim oExcel As Variant
为 Dim oExcel As Excel.Application,则会出现程序错误。任何人都可以提出任何想法吗?我是为宏编程 vba 的新手