Set Zoom for Report using VBA or PrtDevMode

Mark Fraser

New member
Local time
Today, 16:25
Joined
Feb 2, 2001
Messages
6
Hi,

I'm trying to set the zoom level for a report print preview using VBA. I already set the Orientation using PrtDevMode. Any suggestions to set zoom level on OnOpen.

Thanks Much,
 
After looking through the object browser at the acCmdZoom constants I couldn't get them to apply, so I wrote this dirty sendkeys instruction:

SendKeys "%V+Z"
SendKeys "(RIGHT)"
SendKeys "(DOWN)"
SendKeys "(DOWN)"
SendKeys "(DOWN)"
SendKeys "~"

If you get a better answer let me know.
PS - The no of (DOWN)'s you put in denotes the zoom chosen.

Ian
 
Can't you just use right click?
 
Rich, I think Mark is trying to do it automatically, maybe you know that? Can you expand your answer for me please..
 
Yes your right Ian I was temp brain dead yesterday.
To use acCommand you have to add it to the command button opening the report
ie.DoCmd.OpenReportetc
DoCmd.RunCommand acCmdZoom150
Richie.
 
Rich,

Maybe you can help me, I've put this code behind a button to open a quick report called Table1(for test purposes only)

Dim stDocName As String
stDocName = "Table1"
DoCmd.OpenReport stDocName, acPreview
DoCmd.RunCommand acCmdZoom25


But the runcommand just doesn't seem to do anything at all but doesn;t cause an error

Does it work on your machine?
Am I suffering from a bout of brain deadness also?

Ian
 
Can't see anything wrong with code at all only thing I can think of is that I tried the code on a report which removes the menu bar and report caption also sets report window to maximize maybe one of those alters the zoom command, I'll try the code on a normal report to test it again.
Richie
 
Thanks for the help, Rich and Fornation. I'll give those a shot.


Mark
 
I tried the
DoCmd.RunCommand acCmdZoom150 statement from the command button and I got a "Command or action 'acCmdZoom150' isn't available now" error.

Could this command be in a reference that I haven't enabled?

Mark
 
Mark,

I got the same result when I put it in the OnOpen Event and Activate Event. I haven't a clue where to put it!!

Ian
 
The command is correct as Ian posted on his command button I've tried the code with several reports and it worked on all I have no suggestions to offer regarding it not working on yours. missing reference maybe?
 

Users who are viewing this thread

Back
Top Bottom