How to set Margins and Paper orientation from VBA for PrintReview

Posted on 2003-03-03
Medium Priority
Last Modified: 2008-03-04
I have many forms that are displayed maximized (both screen size and long forms) and have a PrintPreview function attached that sends these forms to printpreview.

I'm upgrading this function and adding resizing to fit an 8.5 x 11 inch page less margins and depending on horizonal to vertial aspect either portrait or landscape.

How do I access the page margins and set the page orientation from VBA?   Also can you explain where I can find this information as I really hate having to ask all the time for this type of info.



Question by:katzwhite
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
  • 2
LVL 41

Accepted Solution

shanesuebsahakarn earned 1200 total points
ID: 8061547
You could do this using the PrtMip property, but this is read-only unless you are in design view. You can open the form in design view using the DoCmd.OpenForm statement and then modify the PrtMip property accordingly (which means the print preview couldn't be placed on the form that you want to change, so I don't know if this is suitable.

To find more info on this property (plus other VBA properties, methods and functions), press F1 when viewing a code module tobring up VBA help (in Access 97, you can just open help from anywhere, it's all in one file). Type PrtMip into the Answer Wizard and it's got a good example listed as well.

Author Comment

ID: 8061792
I also found Prtdevmode which I think will allow changing the paper origination.

Thanks for the Assistance


LVL 41

Expert Comment

ID: 8061812
NP, glad I could help point you in the right direction!

Featured Post

Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Suggested Courses

765 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