Hi Norie,
As a test, I separated the PDF printing code from the report creation code into three macros; your code for report creation, mine for report creation and the original code for PDF creation.
Using your code as follows:
I get Run-time error '1004': Method of object '_Application' failed and debug points to:
Using my original code for report creation as follows:
Works without errors every time.
The original code for exporting the MatchReport sheet to a PDF file is as follows:
Works without errors every time.
Maybe I just need to call the Print_PDF macro within the Create_MatchReport after the report is created correctly. The problem has now changed so I'll look around for the answer and post a new thread if I can't find what I'm looking for otherwise.
Thank you Norie for all of your help and patience. You showed me how to set the name of the output PDF file and I am grateful. I don't know why your code would work for you and not me. Maybe you have a different version of Excel or different OS? I have Excel 2010 32-bit and Win 7 Pro 64-bit, both fully up to date and running on a HP EliteBook 8560W, with 8GB of RAM. It's a good system and I don't have any problems with it otherwise.
For now I'll work with the two macros separated and look for a way to combine them.
Bookmarks