katkth7533
New Member
- Joined
- Aug 18, 2014
- Messages
- 14
Hi:
I was looking for some help in setting the print orientation and paper size for an excel document in VBA. This document is being used by multiple people and despite asking them no to change the printing options, they sometimes do. I have a code to print the file from another excel file and that code involved filtering the report before printing. The code is as follows:
I would like to add a Page Set-up option to this also, something along the lines of
but I am not sure where to place these lines in the code without causing an error. I would also like the code to include a code to print the document on one side only (as opposed to 2 sided printing) but I am not sure how to do that.
Any ideas?
I was looking for some help in setting the print orientation and paper size for an excel document in VBA. This document is being used by multiple people and despite asking them no to change the printing options, they sometimes do. I have a code to print the file from another excel file and that code involved filtering the report before printing. The code is as follows:
Code:
Sub Set_Open_CentralTask8()
Dim wkb As Workbook
Application.ScreenUpdating = False
Application.AskToUpdateLinks = False
Application.DisplayAlerts = False
Set wkb = Workbooks.Open(Filename:="http://collabo/projects/DesignandConstructionProjectControls/Project Reporting/Development/Pipeline Reports/Central Region/Project_8.xlsm")
With wkb.Sheets("TASKS")
.Unprotect Password:="pipe"
.Range("Ai7:Ai626").AutoFilter Field:=1, Criteria1:="FALSE"
.Range("A1:I626").PrintOut Copies:=1
.Range("Ai8:Ai626").AutoFilter
.Protect Password:="pipe"
End With
wkb.Close False
Application.ScreenUpdating = True
End Sub
I would like to add a Page Set-up option to this also, something along the lines of
Code:
With PageSetup
.Orientation = xlLandscape
.PaperSize = xlPaperA3
Any ideas?