?
Solved

Landscape to Portrait?

Posted on 2003-03-19
6
Medium Priority
?
1,859 Views
Last Modified: 2012-06-21
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
0
Comment
Question by:katzwhite
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 14

Accepted Solution

by:
mgrattan earned 2000 total points
ID: 8170697
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.
0
 
LVL 9

Expert Comment

by:mcallarse
ID: 8170809
Wouldn't recommend SendKeys, but I'm with mgrattan otherwise: PrtDevMode is probably the most efficient way to do this in code, though I'm sure that you can also change these properties using the Win32 API.

Take a look at the following:

http://msdn.microsoft.com/library/default.asp?url=/archive/en-us/accessdev/html/ODC_MicrosoftOfficeDeveloperForumControllingYourPrinterinMicrosoftAccess.asp
0
 
LVL 5

Expert Comment

by:gwgaw
ID: 8171845
You can use the following to change the printer orientation in code while the form is in run mode. Although the print preview of the form will not change, the form will print correctly.

Me.Printer.Orientation = 1 change to portrait
Me.Printer.Orientation = 2 change to landscape

gaw
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 2

Expert Comment

by:TT2
ID: 8172704
If you want a straight fix for a report that you want to print in landscape mode, all the time... you can change the any of the Page Setup options (even specific printer) with the report in Design View and then save it whilst simultaneously holding-down the "Ctrl" key on the keyboard.  

Although undocumented, this works in Access 2K and I assume it will also work with other versions of Access, if yours is different.

Print Preview should also work correctly with the saved settings.

I hope I haven't got the "wrong end of the stick" with this comment and that it's relevant to your question.

Glen Ashton
0
 

Author Comment

by:katzwhite
ID: 8374985
Sorry to be so long in accepting this answer.  Forgot!

Thanks for the help

Elton
0
 
LVL 14

Expert Comment

by:mgrattan
ID: 8375558
No problem!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question