Excel 2016 VBA Run-time error '1004': Your changes could not be saved...

Can anybody help me debug this line in the Macro I'm trying to do please,

Sub SaveWithNewName()

    Dim NewFN As Variant


    NewFN = "Users/gozmani/Desktop/IG Networks LTD/Inv" & Range("F4").Value & ".xlsx"

    ActiveWorkbook.SaveAs NewFN, FileFormat:=52



End Sub

I tried different file format codes but can't make it work, I get the Error 1004 message "Your changes could not be saved to 'Inv2091.xlsx', but were saved to a temporary document...."


Question Info

Last updated September 17, 2018 Views 1,128 Applies to:

This doesn't solve my problem. Having the same as above listed.

I'm using ActiveWorkbook.Path & Application.PathSeparator & NewFilename to build my string for executing

ActiveWorkbook.SaveAs Filename:=FilenameStr, FileFormat:=xlCSV

and it just gives 1004 errors.


So, I instead went and Recorded the macro and performed the action. Other than putting the Path and filename explicitly in single quotes, the code was nearly the same. I replaced my variable FilenameStr in to the command and then it worked. The only other difference was that it split the command into two lines and appended them with _

I think this is a bug.

4 people were helped by this reply


Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.