Help with Code to set margins & orientation

TheNoocH

Well-known Member
Joined
Oct 6, 2004
Messages
3,482
I have the following code to print a report....i would like to add code to set the orientation and margins....for some reason it's not keeping what i had when i save the report so i figure if i code it then there shouldn't be an issue...any help would be great....

Code:
Function PrintReport()
On Error GoTo PrintReport_Err

    DoCmd.SetWarnings False
    DoCmd.OpenQuery "qryModelsElevations", acNormal, acEdit
    DoCmd.OpenQuery "qryModelsOptions", acNormal, acEdit
    DoCmd.OpenQuery "qryTempGroupElevations", acNormal, acEdit
    DoCmd.OpenQuery "qryTempGroupOptions", acNormal, acEdit
    DoCmd.OpenReport "rptOrderConfig", acPreview, "", ""
    


PrintReport_Exit:
    Exit Function

PrintReport_Err:
    MsgBox Error$
    Resume PrintReport_Exit

End Function

Private Sub cmdPrintReport_Click()
   PrintReport
   DoCmd.SetWarnings True
End Sub
[/code]
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Well i figured it out...alot easier than i thought....here's the code in case anyone wanted to know...


Code:
    Printer.BottomMargin = 0.5
    Printer.TopMargin = 0.5
    Printer.RightMargin = 0.5
    Printer.LeftMargin = 0.5
    Printer.Orientation = acPRORPortrait
 
Upvote 0

Forum statistics

Threads
1,221,841
Messages
6,162,314
Members
451,759
Latest member
damav78

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