Forum Discussion
srohde60
Jun 04, 2022Copper Contributor
Method SaveAs Fails with 1004 error unless destination is same location as PERSONAL.XLSB
1 of 4 • DESIRED WORKFLOW Open a one-sheet XLSX file (the source file) anywhere on my computer. From the source file, run a macro from my PERSONAL.XLXB file that... copies the sheet in the source...
Subodh_Tiwari_sktneer
Jun 05, 2022Silver Contributor
The only issue I see is at line#44 where you are still using ActiveWorkbook.SaveAs, try to replace that line with the following one and see if this resolves the issue for you...
'Save the exported CSV file
outputFile.SaveAs Filename:=destinationPath & "/" & myFileName, _
FileFormat:=xlCSVUTF8, CreateBackup:=False
Otherwise, your code looks fine. I tested it and it worked for me without any issue.
- srohde60Jun 10, 2022Copper Contributor
Thanks for your response and for catching my oversight with line #44; however, the issue persists, even after replacing ActiveWorkbook.SaveAs with outputFile.SaveAs.
I'm not alone with the issue. Just search online for "SaveAs Fails with 1004 error".
For me, SaveAs works for other file formats (for example xlOpenXMLWorkbook), but not for CSV file types, i.e. xlCSVUTF8 xlCSVMac and xlCSV.
I'm using Excel for Mac, v 16.61.1 on macOS 12.3.1.