I am looking for code that assigns the right printing orientation and f.i. margins for a specified reports.
I am trying to use the following code for setting the orientation:
Sub setOrientation(r As Report, orientation As Integer)
'
' Changes the orientation of a report that is opened in DESIGN mode
'
Dim dm As str_DEVMODE
Dim DevMode As type_DEVMODE
DoCmd.OpenReport r, acDesign
If Not IsNull(r.PrtDevMode) Then
dm.RGB = r.PrtDevMode
LSet DevMode = dm
DevMode.orientation = orientation
LSet dm = DevMode
r.PrtDevMode = dm.RGB
End If
End Sub
Executing call setOrientation(Rpt_xx,0) gives an error message;"ByRef argument types do not match"
I must say that I don't understand exactly what this code does.
Can somenone help me with the right code and maybe some general information over how to control output by VBA?
Thanks,
Frans
I am trying to use the following code for setting the orientation:
Sub setOrientation(r As Report, orientation As Integer)
'
' Changes the orientation of a report that is opened in DESIGN mode
'
Dim dm As str_DEVMODE
Dim DevMode As type_DEVMODE
DoCmd.OpenReport r, acDesign
If Not IsNull(r.PrtDevMode) Then
dm.RGB = r.PrtDevMode
LSet DevMode = dm
DevMode.orientation = orientation
LSet dm = DevMode
r.PrtDevMode = dm.RGB
End If
End Sub
Executing call setOrientation(Rpt_xx,0) gives an error message;"ByRef argument types do not match"
I must say that I don't understand exactly what this code does.
Can somenone help me with the right code and maybe some general information over how to control output by VBA?
Thanks,
Frans