PRTDEVMODE

  • Thread starter Thread starter Phil Stanton
  • Start date Start date
P

Phil Stanton

Sorry to cross post, but getting no replies on the other Access NG

I have a report the size is A5 landscape. I need to get the page dimensions
using VBA.

If I open the report in PrintPreview I get

Using the well documented with such expressions as
strDevModeExtra = Rpt.PrtDevMode
' Gets current DEVMODE structure.
DevString.RGB = strDevModeExtra

I eventually get the information that
DM.intPaperLength = 2970 and
DM.intPaperWidth = 2100 and
DM.intOrientation = 1

This corresponds to A4 portrait.

I then open the report in design view, go to page set up. Change a margin
from 10mm to 11mm and back again to 10mm to force me to save the report. If
I then open the report in PrintPreview I get all the right answers i.e

DM.intPaperLength = 2100 and
DM.intPaperWidth = 1480 and
DM.intOrientation = 2

This is the correct A5 landscape.

How can I get the correct information using VBA

TIA

Phil
 
PrtDevMode is not easy to work with, illustrated by the fact that Microsoft
got the Help file examples wrong in Access 95, 97, and 2000 (and probably
later versions - I gave up checking), and not just the same error (i.e. in
different places in different versions).

If you need to go this way, the best resource I can suggest is:
http://www.microsoft.com/AccessDev/Articles/GetzCh10.HTM
 
Thanks Allen.

Needs a bit of concentrated reading, but I think I can see the solution

Phil
 
Back
Top