Search code examples
vbaexcelsave-as

I am getting Error 424 while trying to save a file using Excel vba


Here is the statement -

pasteBook.SaveAs fn:=folderName & "\Excels\" & fn & " " & Format(DateTime.Now(), "MM-dd-yyy"), FileFormat:=51

Note - pasteBook is defined to be as the current ThisWorkbook. I keep getting the following message box

Run-time eror '424':
Object required

Solution

  • ThisWorkbook.SaveAs Filename:="fred" Not

    ThisWorkbook.SaveAs fn:="fred"

    If you're usingh named arguments to a function they have to be the right names!