I received an invalid procedure call or argument when running this section of a Macro I've written to print out worksheets as a PDF. When running the script, the error occurs with the following section of code:

ActiveSheet.ExportAsFixedFormat _
        Type:=xlTypePDF, _
        filename:=mypath, _
        Quality:=xlQualityStandard, _
        IncludeDocProperties:=True, _
        IgnorePrintAreas:=False, _
        OpenAfterPublish:=False
I am able to use the same Macro in a different workbook, but when I try to use it in the current one I am using, it errors out at this point in the execution.

Any thoughts on how to fix it? Since it works in other files, I think it might be a setting I am overlooking.

Note: mypath is defined as my desktop.