How to change print preview window settings in VBA

G

Guest

Access 2003:

Print window needs to open with the report in the center of a maximized
window and with a preset zoom setting.

Thanks
 
P

pietlinden

RobGMiller said:
Access 2003:

Print window needs to open with the report in the center of a maximized
window and with a preset zoom setting.

Thanks

So what have you tried so far? (the archive?, the help file?)

just modify the code the wizard writes...


Private Sub cmdPreviewReport_Click()
On Error GoTo Err_cmdPreviewReport_Click

Dim stDocName As String

stDocName = "Needs by Location"
DoCmd.OpenReport stDocName, acPreview
DoCmd.Maximize
DoCmd.RunCommand acCmdZoom200

Exit_cmdPreviewReport_Click:
Exit Sub

Err_cmdPreviewReport_Click:
MsgBox Err.Description
Resume Exit_cmdPreviewReport_Click

End Sub


Not sure how to force it to be centered, though.
 
M

Marshall Barton

RobGMiller said:
Access 2003:

Print window needs to open with the report in the center of a maximized
window and with a preset zoom setting.


Try setting the report's AutoCenter property to Yes.

You can set the Zoom factor by executing:

DoCmd.RunCommand acCmdZoomNNN

immediately after the DoCmd.OpenReport statement.

The allowed arguments are:
acCmdZoom10
acCmdZoom100
acCmdZoom1000
acCmdZoom150
acCmdZoom200
acCmdZoom25
acCmdZoom50
acCmdZoom500
acCmdZoom75
acCmdSizeToFit
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top