greatscottbattman
New Member
- Joined
- Mar 30, 2009
- Messages
- 13
Hello excel community,
I don't have much experience with scripting. All of my macros have been created by either recording macros and coping codes from help areas like this. The question I have is as follows:
I'm trying to setup a print macro so that it will print to tabloid(11x17).
The code I have thus far is below. The problem I face is that some printers will take the .xlpapertabloid but not the .xlpaper11x17 code and vice versa.
Using xerox 7335 PS ok with 11x17 but not tabloid
Using xerox 5638 ok with tabloid but not 11x17
Error message: Unable to set the papersize property of the pagesetup class.
Is there a way to program both in the script?
Any suggestions and improvements to the code would be greatly appreciated.
Private Sub CommandButton1_Click()
ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
Sheets("YTD Cost").Select
ActiveSheet.PageSetup.PrintArea = "$3:$88"
With ActiveSheet.PageSetup
.PaperSize = xlPaperTabloid
End With
Range("$3:$88").Select
ActiveSheet.PageSetup.PrintArea = Selection.Address
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Range("A3:EJ3").Select
End Sub
I don't have much experience with scripting. All of my macros have been created by either recording macros and coping codes from help areas like this. The question I have is as follows:
I'm trying to setup a print macro so that it will print to tabloid(11x17).
The code I have thus far is below. The problem I face is that some printers will take the .xlpapertabloid but not the .xlpaper11x17 code and vice versa.
Using xerox 7335 PS ok with 11x17 but not tabloid
Using xerox 5638 ok with tabloid but not 11x17
Error message: Unable to set the papersize property of the pagesetup class.
Is there a way to program both in the script?
Any suggestions and improvements to the code would be greatly appreciated.
Private Sub CommandButton1_Click()
ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
Sheets("YTD Cost").Select
ActiveSheet.PageSetup.PrintArea = "$3:$88"
With ActiveSheet.PageSetup
.PaperSize = xlPaperTabloid
End With
Range("$3:$88").Select
ActiveSheet.PageSetup.PrintArea = Selection.Address
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Range("A3:EJ3").Select
End Sub