Skip to main content
Known Participant
January 11, 2025
Question

Excel VBA can't save as pdf anymore

  • January 11, 2025
  • 2 replies
  • 1596 views

After years working, since 2025-01-06 my Excel VBA macros saving a worksheet as pdf get "run-time Error 1004 - Document not saved. Maybe the file is open or troubles when saving".  The stopping command is

 ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=fn, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False
The worksheet copied with these macros on a second PC still works smoothly. The two PCs are updated and aligned:

Windows 10 Pro (upd KB5048652)

Microsoft® Excel® for Microsoft 365 MSO (Version 2412 Build 16.0.18324.20092) 64 bit

VBA 7.0.1

Adobe Acrobat Pro v. 2024.005.20320 (un- and re-installed)

On both, however, also exporting the pdf manually with the PDFMaker plugin is VERY long and troubled, Excel hangs for minutes and the worksheet is forced-closed and re-opened at the end by the PDFMaker plugin. Last, manually Saving As .pdf in the File dialog works smoothly in the second PC, while gives the same "Document not saved" msg in the "bugged" one.

Did anyone meet a similar bug?

2 replies

try67
Community Expert
Community Expert
January 11, 2025

This looks like a Microsoft issue, not an Adobe one. That command doesn't use Acrobat to generate the file, as far as I can see.

Known Participant
January 11, 2025

Many thanks, you're probably right. Actually I can't say which piece of software is involved, I thought that maybe the Adobe plugin PDFMOfficeAddin.dll could play some role. And every other output format but .pdf works normally in the VBA macros. 

Peru Bob
Community Expert
Community Expert
January 11, 2025

I've moved this from the Using the Community forum (which is the forum for issues using the forums) to the Acrobat forum so that proper help can be offered.

Scroll down here to see a list of the forums:
https://community.adobe.com/

Known Participant
January 11, 2025

Sorry, I'm new... Thank you