I believe it will do what you requested. It did not do so in my testing, however. I suspect a problem with my Office Insider version of Excel, as my file folder was littered with about 30 .tmp files and the row height increased on the display.
Jeff McClellan
ASKER
Nope. Did not save on mine either. Office 365
byundt
Where did you put the code? It must go in ThisWorkbook code pane, and will not work at all if you put it anywhere else.
Also, you must save the file with .xlsm file extension and enable macros when you open the workbook.
FWIW, I had no trouble with the file saving as .pdf. My problem was when the macro tried to print afterwards.
Put the code in ThisWorkbook.
Saved the Excel file with the xlsm extension.
File prints, but no PDF generated.
Macro generates 57 tmp files of 0 KB.
Macro throws the error below. When I click Debug or End, Excel closes and restarts.
(see attached screenshot)
Robberbaron (robr)
needs testing.
calling the ExportAsFixedFormat actually triggers the Workbook_BeforePrint, causing an infinite loop.
Triggered my interest as well so will try to resolve.
Thank you both for the excellent and skilled advice. Works perfectly. I'm very grateful to have found you through Experts Exchange! I hope I can have access to your input on future projects. Sincerely, Jeff
Open in new window
Put the above code in ThisWorkbook code pane.I believe it will do what you requested. It did not do so in my testing, however. I suspect a problem with my Office Insider version of Excel, as my file folder was littered with about 30 .tmp files and the row height increased on the display.