Sub test()
Dim objXL
Set objXL = CreateObject("Excel.Application")
Dim FileName As Variant
Dim UpdateLinks As Variant
Dim ReadOnly As Variant
With objXL
.Workbooks.Open(FileName:= "test.xls",UpdateLinks:=0,ReadOnly:=False)
.Visible = True
End With
Set objXL = Nothing
End Sub
这是我用来在宏中打开 Excel 文件的代码,但它在第 8 行使用 Workbooks.Open() 函数报告了语法错误。我尝试过,但无法弄清楚我错在哪里。关于 Workbooks.Open() 函数的更多信息可以在这里找到:http: //msdn.microsoft.com/en-us/library/office/ff194819 (v=office.15).aspx
感谢您的关注!