VBA- Saving a copy of file with both an initial file name and file filter

Newland, Daniel 0 Reputation points
2023-10-11T17:16:29.3066667+00:00

I am trying to save a coy of a file that has the save as window pop up with an initial name and set to an xlsm file type. Here is the code I have but it is not working:

ActiveWorkbook.SaveCopyAs Application.GetSaveAsFilename (InitialFileName:=Sheets("Sheet2").Range("A1") & "Priorpolicyinfo17",FileFilter:= “Excel Files (.xlsm), xlsm”)

Thanks in advance for the help.

Microsoft 365 and Office Development Other
Microsoft 365 and Office Excel For business Windows
{count} votes

1 answer

Sort by: Most helpful
  1. Tanay Prasad 2,250 Reputation points
    2023-10-12T06:16:17.4766667+00:00

    Hi,

    Try using this code once and let me know if it works-

    ActiveWorkbook.SaveCopyAs Application.GetSaveAsFilename(InitialFileName:=Sheets("Sheet2").Range("A1") & "Priorpolicyinfo17.xlsm", FileFilter:="Excel Files (*.xlsm), *.xlsm")
    
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.