當試圖運行下面的我得到以下錯誤:運行時錯誤1004
"This extension can not be used with the selected file type. Change the file extension in the file name text box or select a different file type by changing the save as type."
代碼:
Dim strPath As String
Dim strFolderPath As String
strFolderPath = "Y:\
strPath = strFolderPath & _
Sheet1.Range("A1").Value & _
Sheet1.Range("B1").Value & ".xlsx"
ActiveWorkbook.SaveAs Filename:=strPath
是,excel 2007 – john
如果ActiveWorkbook包含宏,則需要使用「xlsm」擴展名和參數FileFormat:= XlFileFormat.xlOpenXMLWorkbookMacroEnabled進行SaveAs。 –