Set objExcel = CreateObject("Excel.Application")
Set ResBook=objExcel.WorkBooks.open("C:\test.xls")
Set ResSheet=ResBook.WorkSheets("Sheet1")
msgbox ResSheet.Range("A65535").End(xlUp).Row
Set xlHandler = CreateObject("Excel.Application")
xlHandler.DisplayAlerts = False
Set xlBook = xlHandler.WorkBooks.Open("D:\Temp01\test.xls")
'xlBook.RunAutoMacros xlAutoOpen
xlHandler.Run "Sheet1.test"
xlBook.Save
xlBook.Close
xlHandler.Quit
Set xlBook = Nothing
Set xlHandler = Nothing
'Macro define in the Sheet1
Sub test()
Set Rng = Worksheets(1).Range("A:A")
MsgBox Application.WorksheetFunction.CountA(Rng)
End Sub
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) | Powered by Discuz! X3.2 |