M
me
Good Afternoon everyone.
I need help with the following code:
Code/
Option Explicit
Sub selectAll()
Dim ws As Sheet5
Dim printMe As Range
'***** turn off
Application.ScreenUpdating = False
Set ws = Application.Sheets("InitialAssessments")
'***** THIS IS YOUR DYNAMIC RANGE HERE
ws.Activate
Set printMe = ws.UsedRange
'***** these are just options
ws.PageSetup.PrintArea = printMe.Address(False, False)
With ws.PageSetup
'***** manually set margin??????
.LeftMargin = Application.InchesToPoints(0)
.RightMargin = Application.InchesToPoints(0)
.TopMargin = Application.InchesToPoints(0.25)
.BottomMargin = Application.InchesToPoints(0.5)
.HeaderMargin = Application.InchesToPoints(0.25)
.FooterMargin = Application.InchesToPoints(0.25)
'*****
'***** other options here.
.CenterHorizontally = True
.CenterVertically = False
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
'***** printing here
ws.PrintOut Copies:=1, Collate:=True <----PROBLEM HERE.
'***** turn back on
Application.ScreenUpdating = True
End Sub
/Code
I get a "method Print Out of Worksheet object failed". I've tried to
figure it out, but to no avail. Please help.
Suggestions?
I need help with the following code:
Code/
Option Explicit
Sub selectAll()
Dim ws As Sheet5
Dim printMe As Range
'***** turn off
Application.ScreenUpdating = False
Set ws = Application.Sheets("InitialAssessments")
'***** THIS IS YOUR DYNAMIC RANGE HERE
ws.Activate
Set printMe = ws.UsedRange
'***** these are just options
ws.PageSetup.PrintArea = printMe.Address(False, False)
With ws.PageSetup
'***** manually set margin??????
.LeftMargin = Application.InchesToPoints(0)
.RightMargin = Application.InchesToPoints(0)
.TopMargin = Application.InchesToPoints(0.25)
.BottomMargin = Application.InchesToPoints(0.5)
.HeaderMargin = Application.InchesToPoints(0.25)
.FooterMargin = Application.InchesToPoints(0.25)
'*****
'***** other options here.
.CenterHorizontally = True
.CenterVertically = False
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
'***** printing here
ws.PrintOut Copies:=1, Collate:=True <----PROBLEM HERE.
'***** turn back on
Application.ScreenUpdating = True
End Sub
/Code
I get a "method Print Out of Worksheet object failed". I've tried to
figure it out, but to no avail. Please help.
Suggestions?