Can you programatically set the page orientation of the default printer ?
I have tried: printer.orientation = 2
BUT it always stays in the default port. mode
Printable View
Can you programatically set the page orientation of the default printer ?
I have tried: printer.orientation = 2
BUT it always stays in the default port. mode
try printer.orientation=vbPROPLandscape
or
printer.orientation=vbPRORPortrait
I don't know if it'll work but it's worth a try
I tried what you suggested but no luck.
Here's what my code within a pushbutton click event looks like now:
-code snip--------------------------------------------------
Printer.Orientation = vbProrLandScape ' Page to landscape
rptStock.Show ' Show report
------------------------------------------------------------
First you must set the default printer as printer then you may change the properties. Let me know if this doesn't work.
For Each xPrinter In Printers
If xPrinter.DeviceName = Printer.DeviceName Then
' Set printer as system default.
Set Printer = xPrinter
Printer.FontName = "Courier New"
Printer.FontSize = 11
Printer.PrintQuality = vbPRPQDraft
Printer.Orientation = vbPRORPortrait
'below shows user and programmer what the default printer is and what font is being used etc.
MsgBox "Printer.Orientation = " & Printer.Orientation & " Printer.fontname = " & Printer.FontName & " and printer.fontsize = " & Printer.FontSize & " Printer.DeviceName = " & Printer.DeviceName
' Stop looking for a printer.
Exit For
End If
Next
Hoped this helped
Setting the orientation of the printer object, is only usefull if you use the printer object to print.
rptStock.Show ' Show report
If you print from a report, the PrinterOrientation must probably be set in the report, and not in the printer object.