On Open, Format Report

foxhound

Board Regular
Joined
Mar 21, 2003
Messages
182
Hello,

Does anyone know the code to automatically set the "On Open" code to make a report portrait, letter size, with .5" margins?
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Corticus,

Thank you very much for your response. I have been searching everywhere to find code to make this happen. It's too bad that this can't be done because it would save me a lot of headaches! o_O
 
Upvote 0
Hullo. It actually can be done. You just cannot be at all worried about using some rather "raw" API calls to the Windows print system. I do something extemly similar with a report of mine that was designed on legal setup. It was annoying to switch the page layout whenever we needed to check something, so, I wanted it to preview/print automagically on legal. The following link http://ourworld.compuserve.com/homepages/attac-cg/acgsoft.htm helped rather a lot.

You'll need to set up a form with a report launch button, because as near as I can tell, this will only work if something CALLS the report, not if you preview/print the report directly.

If you have questions or problems, let us know.

HTH (y)

P
 
Upvote 0
Nice Philem,

It was suggested in my link that I could use API to do what I wanted (and the OP wanted) but it was never actually provided. Thanks for providing a final solution to this.

I noticed that there was no way to set the number of columns property, unfortunately, which was what got me looking for a way to manipulate the page setup properties in the first place, but it looks like you got the OP in this thread well covered.

Thanks!
 
Upvote 0

Forum statistics

Threads
1,221,531
Messages
6,160,357
Members
451,642
Latest member
mirofa

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top