AllExperts > Experts 
Search      

VB Script

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More VB Script Answers
Question Library

Ask a question about VB Script
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Igor
Expertise
WSH 5.6, ADO, CDO, WMI, IE as Object.

Experience
WSH 5.6, ADO, CDO, WMI, IE as Object.

 
   

You are here:  Experts > Computing/Technology > Basic > VB Script > set margins for a page

Topic: VB Script



Expert: Igor
Date: 3/7/2005
Subject: set margins for a page

Question
Dear Igor

I have created an inventory report in Access 2003
When I print this form somehow the margins for the page change. Could you help me with a code that set the top, bottom, left and right margin when I run my report.

Thanks in advance for your help and time.

Best regards,

Dennis

Answer
for example
Public Sub SetMarginsToDefault(ByVal strName As String)

   Dim PrtMipString As str_PRTMIP
   Dim PM As type_PRTMIP
   Dim rpt As Report
   
   ' Open the report.
   DoCmd.OpenReport strName, acDesign
   Set rpt = Reports(strName)
   PrtMipString.strRGB = rpt.PrtMip
   LSet PM = PrtMipString
   
   ' Set margins.
   PM.xLeftMargin = 1 * 1440
   PM.yTopMargin = 1 * 1440
   PM.xRightMargin = 1 * 1440
   PM.yBotMargin = 1 * 1440
   
   ' Update property.
   LSet PrtMipString = PM
   rpt.PrtMip = PrtMipString.strRGB
   
   Set rpt = Nothing
   
End Sub


Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.