I have an 2007 Access database that pull data from an AS/400 and saves the data in excel. I just added the option to save the excel file as a PDF instead of excel. This code works the first time. But the second report gets the error. If I compact and repair the same report that caused the error works but the next one doesn't. Any Ideas?
Code:
ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, FileName:=strSaveAs, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
Error:
91 - Object variable or With block variable not set
strSaveAs = "j:\XLS\FileName.PDF"
xlTypePDF = 0
xlQualityStandard = 0
Code:
ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, FileName:=strSaveAs, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
Error:
91 - Object variable or With block variable not set
strSaveAs = "j:\XLS\FileName.PDF"
xlTypePDF = 0
xlQualityStandard = 0
Last edited: