我發送了一個.xls文件以在我的宏中使用。 .xls文件的問題在於它們無法處理運行我的宏所需的行數。因此,爲了解決這個問題,我試圖首先保存我作爲.xlsx文件發送的文件,然後按照計劃繼續使用宏。不幸的是,一旦我達到 APPSInvoiceWB = Workbooks.Open(APPSInvoiceFN & "x")
我收到一個錯誤:對象需要。我的代碼有什麼問題?我是否正在採取最佳方法解決我的.xls問題?需要將xls文件保存爲xlsx,關閉然後重新打開它
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")