I have written a procedure that is supposed to cycle through all of the worksheets in the active workbook and print any that meet the criteria in the code. I keep getting a run time error when running this procedure. Could someone review my procedure and see if I am missing anything. I have been able to use the oSheet.PrintOut method in other procedures with success, but I can't seem to get it to work in this one.
' Created by Steven M Henderson on August 21, 2001
' This procedure will cycle through the worksheets of the active
' workbook and print all of the CPWU worksheets ignoring the
' built in worksheets used to create everything else
Dim oSheet As Worksheet
For Each oSheet In Worksheets
If oSheet.Name <> "Template" _
And oSheet.Name <> "RCList" _
And oSheet.Name <> "Template(2001)" _
And oSheet.Name <> "List" _
And oSheet.Name <> "DataLibrary" _
And oSheet.Name <> "DataLib" Then
'fall through by design
I have also attached a screenshot of the error message.