The orientation is what I want to set programmatically, and it seems it sort of works. If I write out what the orientation is before anythign is set, it returns a "1" which is portrait. If I set it, and write it out again, it returns a "2" for landscape. However, if I go into my printer settings for that printer, it's still showing portrait, and it still prints portrait from my code.
- Code: Select all
Try
Dim objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Dim colPrinters = objWMIService.ExecQuery("Select * from Win32_PrinterConfiguration") ' where Name = '\\\\SERVER\\PRINTER_NAME'")
For Each objPrinter In colPrinters
objPrinter.PageSettings.Landscape = True
MsgBox(objPrinter.orientation)
Next
Catch ex As Exception
MsgBox(ex.ToString)
End Try
