Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,564
- Office Version
- 365
- 2016
- Platform
- Windows
Would someone be able to guide me to a solution to defeat the " Printout method of Worksheet class failed." error I'm getting in the highlighted line of code below?
Rich (BB code):
Sub printme_d()
Dim rwtopLeft As Long, coltopLeft As Long
Dim rwbtmRight As Long, colbtmRight As Long
Dim diarng As Range
'Stop
rwtopLeft = Application.WorksheetFunction.VLookup("D", ws_lists.Range("X3:AD10"), 3, False)
coltopLeft = Application.WorksheetFunction.VLookup("D", ws_lists.Range("X3:AD10"), 4, False)
rwbtmRight = Application.WorksheetFunction.VLookup("D", ws_lists.Range("X3:AD10"), 5, False) + 43
colbtmRight = Application.WorksheetFunction.VLookup("D", ws_lists.Range("X3:AD10"), 6, False) + 55
'Stop
Set diarng = ws_front.Range(ws_front.Cells(rwtopLeft, coltopLeft), ws_front.Cells(rwbtmRight, colbtmRight))
With ws_front.PageSetup
ws_front.Unprotect
.PrintArea = "J" & rwtopLeft & ":BM" & rwbtmRight
pgnums = .Pages.Count
ws_front.Protect
End With
ui1 = InputBox("Select:" & Chr(13) & " (1) SAVE Only" & _
Chr(13) & " (2) PRINT Only" & _
Chr(13) & " (3) PRINT & SAVE", "Output Selection")
If ui1 = "1" Then
savemed
ElseIf ui1 = "2" Then
Stop
ws_front.PrintOut
ui1 = MsgBox("Pages printed: " & pgnums & Chr(13) & "Retrieve printed pages and return to printer tray, face down, top into machine." & Chr(13) & _
"Press OK to launch print the reverse side of the signature sheets.", vbQuestion + vbOKCancel, "PRINT COMMAND")
If ui1 = vbOK Then
With Worksheets("Dia_Backside").PageSetup
Worksheets("Dia_Backside").Unprotect
.PrintArea = "A1:BD45"
Worksheets("Dia_Backside").Protect
End With
ws_front.Protect
For pg = 1 To pgnums
Worksheets("Dia_Backside").PrintOut
Next pg
End If
Else
ws_front.PrintOut
ui1 = MsgBox("Pages printed: " & pgnums & Chr(13) & Chr(13) & "Retrieve printed pages and return to printer tray, face down, top into machine." & Chr(13) & Chr(13) & _
"Press OK to launch print the reverse side of the signature sheets.", vbQuestion + vbOKCancel, "PRINTING: Diamonds")
If ui1 = vbOK Then
With Worksheets("Dia_Backside").PageSetup
Worksheets("Dia_Backside").Unprotect
.PrintArea = "A1:BD45"
Worksheets("Dia_Backside").Protect
End With
ws_front.Protect
For pg = 1 To pgnums
Worksheets("Dia_Backside").PrintOut
Next pg
End If
savemed
End If
End Sub