Script for Exporting Report into Excel As One Page


I have reports automated into Excel. However, when I open Excel, the report isn’t on one page in order to print. It shows up on the same sheet, but not within the printer margins. I ran a macro in Excel in order to make the report one page. However, I was wondering if it would be possible to adjust settings or create a script in the report that would automatically set the report in the one page margins?

If you need more information, please let me know.

Thank you!

I’m not totally tracking with what is occuring. But you can try either of these to see if it helps.

  1. Export the data to a specific cell and row. This controls where the data is put on the sheet.

  2. If you are using TDA 2.7 you can run your macro as part of the export.


Thank you for your reply.

How would I run the macro as part of the export? I have the reports in an automation.


See this reply. It discusses how to use mascos in export.


I checked out the link, but I don’t think it is exactly what I need. I have an automation template that contains Toad Report activities. This only gives me the option to select the report and where to save it and what type of file to save it as.

Is there a way to put the macro in this type of set-up? I’m guessing it would have to be in the actual report?

Thanks in advance.


I was thinkin you were exporting to Excel directly. Can you post a copy of the output of the report, your automation scritp and TDR file? I need to fully understand before seeing if I can suggest anything. You can send to if you dont’ want add as attachment.


Here are the print settings available for the report. It does look like you have been experiementing with them.

Unfortunately I can’t find a compbination that overrides the defined print margins. I’d adjust the report to comply with normal paper sizes or I’d build my report in Excel by using a template and just export the data to the row and chart areas.


Okay, I will try one of those.
Thank you very much! I appreciate your help in this matter.