Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 27th, 2004, 11:49 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default Edit "Page Setup" Variables in VBA

I am designing a dynamic report that is built with VBA code, but will be run on different computers. Does anyone know how to access the variables that control the page margins from VBA?

Mike
EchoVue.com
__________________
Mike
EchoVue.com
 
Old October 27th, 2004, 12:00 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Well, if you define a printer object, you can set its margin.

Dim prtPrinter As Printer
prtPrinter.LeftMargin = 1440

This assumes that prtPrinter is your default printer. You can set .BottomMargin, .TopMargin, .LeftMargin, and .RightMargin. Note that the measurement is in twips.

1 inch = 1440 twips
1 centimeter = 567 twips


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old October 27th, 2004, 12:07 PM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Thanks, I'll give it a shot...

Mike
EchoVue.com
 
Old October 27th, 2004, 12:56 PM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Thanks for the help. I couldn't get a Printer Object to work in 2000, or 2003 for that matter, but using that as a basis to do some more searching, I found that with a report name of printReport, I could set the margin using printReport.Printer.TopMargin = 720, rather than declaring the printer object explicitly.

Thanks again


Mike
EchoVue.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Print a page without changing page setup nrajeshatwork Servlets 1 May 23rd, 2007 10:09 AM
Edit registry in vba? Freddyfred Access 1 October 13th, 2004 09:03 AM
How do I setup a dropdownlist for (*Type*) in edit macupryk General .NET 0 October 9th, 2004 07:33 PM
How to pass variables from Aspx page to Asp Page jayaraj Classic ASP Basics 2 May 23rd, 2004 06:56 AM
How to pass the variables in Aspx page to Asp Page jayaraj ASP.NET 1.0 and 1.1 Basics 3 May 23rd, 2004 06:55 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.