Question : Landscape to Portrait?

Prtdevmode explains how to change the paper orientation, but using this code is complicated as the form has to be opened in design mode, the changes made, returned to normal view and several options reset.

Since its possible to manually select File/Page SetUp/Page and select portrait or landscape and update the page orientation without appearing to change the form to design view and returning the form the normal view I'm wondering how do do the same thing in VBA code, maybe the RunCommand could be used to do the same thing?   If so, what code would be needed or how I might find it?

Thanks

Elton

Answer : Landscape to Portrait?

Prtdevmode is the best way to do this in code.  You could use the Echo function to hide what's going on from the user though:

Echo False

Then, after you have completed your Landscape setting using the prtdevmode function you can set the Echo back to true:

Echo True

Another thing to try is the SendKeys function.  You can send the exact keystrokes that you are using to set the landscape mode manually using SendKeys.  I haven't tried it with this particular goal but it might be worth trying.
Random Solutions  
 
programming4us programming4us