N
NHRunner
I have sheet which is a template for a letter to be printed.
The letter can have a variable number of list-like lines it so using the
sheet once filled and printed is problematical so I delete the sheet to be
printed and copy a new one from another sheet which has the base image.
Here is the part of the code which fails.
' If "Printwork" sheet does not exist, create it
' if it does exist, delete it first before copy.
Pwork = False
Set HH = ActiveWorkbook.Sheets
For Each Sht In HH
If LCase(Sht.Name) = "printwork" Then
Pwork = True
End If
Next
Set HH = Nothing
If Pwork = True Then
Sheets("Printwork").Delete
End If
Application.DisplayAlerts = True
' Copy printing template as "Printwork"
Application.DisplayAlerts = False
'Sheets("RenewalTemplate").Select
Sheets("RenewalTemplate").Copy Before:=Sheets(1)
and just in case it is pertinent, here is the code which prints after the
copy and sheet changes are made.
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True,
ActivePrinter:=""
The letter can have a variable number of list-like lines it so using the
sheet once filled and printed is problematical so I delete the sheet to be
printed and copy a new one from another sheet which has the base image.
Here is the part of the code which fails.
' If "Printwork" sheet does not exist, create it
' if it does exist, delete it first before copy.
Pwork = False
Set HH = ActiveWorkbook.Sheets
For Each Sht In HH
If LCase(Sht.Name) = "printwork" Then
Pwork = True
End If
Next
Set HH = Nothing
If Pwork = True Then
Sheets("Printwork").Delete
End If
Application.DisplayAlerts = True
' Copy printing template as "Printwork"
Application.DisplayAlerts = False
'Sheets("RenewalTemplate").Select
Sheets("RenewalTemplate").Copy Before:=Sheets(1)
and just in case it is pertinent, here is the code which prints after the
copy and sheet changes are made.
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True,
ActivePrinter:=""