Excel VBA error 1004 on PDF export - not a path issue

51 views Asked by At

I'm exporting multiple sheets to PDF with the following code:

ThisWorkbook.Sheets(Array("3rd party", "Dashboard", "BS_3rd")).Select
        
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
         fileName:=PDF_FileName, Quality:=xlQualityStandard, _
         IncludeDocProperties:=True, IgnorePrintAreas:=False, _
         OpenAfterPublish:=True

The code works fine with any sheet except "Dashboard". That sheet in any combination (even on its own) causes a

Run-time error '1004': Application-defined or object-defined

error on the second line. Selection is fine, export to PDF runs into this bug.

Please advise.

0

There are 0 answers