I use the following code to print Excel Sheets on the active printer.
Printout is done fine with default printer settings.
I need a way to change the settings for the page being printed in several cases.
e.g. I need one page to be printed in landscape.
I need to know how can I control the page setup before I print.
Imports Excel
Private Sub PrintActions()
Dim xlApp As Global.Excel.Application
Dim xlWkb As Global.Excel.Workbook
xlApp = CreateObject("Excel.Applic
ation")
xlWkb = xlApp.Workbooks.Open("c:\m
yfile.xls"
)
With xlWkb
.Sheets("Sheet3").Select()
.ActiveSheet.PrintOut()
End With
xlWkb.Close()
xlApp.Quit()
End Sub
Start Free Trial