Help with print settings controlled by VBA

Linus_99

Board Regular
Joined
Aug 28, 2002
Messages
145
Hi,

Can someone pls help & advise why the following is not working . . .

I'm using Access 2002 but the file in is Access 2000 format.

I'm trying to print a form in landscape format. (Some reports are to be in portrait and some in landscape). The form is a pivot chart.

Sometimes (and I'm not too sure why it happens) the form comes out in landscape, but mostly it comes out in portrait.

Any advice would be appreciated. Thanks
Linus

My code is:
-----------------------------------------------------
Dim prt as Printer
Dim frm as Form

Set prt = Application.Printer

With prt
.PaperSize = acPRPSA4
.Orientation = acPRORLandscape
End With

DoCmd.OpenForm FormName:=strChartName, View:=acViewPreview

Set frm = Forms(strChartName)

frm.Printer = prt

DoCmd.PrintOut

DoCmd.Close

---------------------------------------------------
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

Forum statistics

Threads
1,221,532
Messages
6,160,380
Members
451,643
Latest member
nachohoyu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top