【发布时间】:2015-12-23 18:14:18
【问题描述】:
我收到了一个 .xls 文件,可以在我的宏中使用。 .xls 文件的问题是它们无法处理我运行宏所需的行数。因此,为了解决这个问题,我尝试首先将发送的文件保存为 .xlsx 文件,然后按计划继续使用宏。不幸的是,一旦我到达
APPSInvoiceWB = Workbooks.Open(APPSInvoiceFN & "x") 我收到一个错误:需要对象。我的代码有什么问题?我是否正在采取最好的方法来解决我的 .xls 问题?
MsgBox "Please select APPS Invoice file"
APPSInvoiceFN = Application.GetOpenFilename'
If APPSInvoiceFN = False Then ' User Pressed Cancel
MsgBox "APPS Invoice file not selected. APPS invoice will not be updated."
Application.ScreenUpdating = True
Exit Sub
Else
On Error GoTo ErrHandler
Set APPSInvoiceWB = Workbooks.Open(APPSInvoiceFN)
On Error GoTo 0
APPSInvoiceWB.SaveAs FileFormat:=51
APPSInvoiceWB.Close savechanges:=True
APPSInvoiceWB = Workbooks.Open(APPSInvoiceFN & "x")
【问题讨论】: