I have this code that works if the tab I want to exclude is standard through out all the documents I am trying to print. However, instead of a specific name of the tab, I would like to use a wildcard (*) to find that reference to exclude from printing.
ShtName = Array("Revision History")
I have tried using ("*Rev*") but didn't work, any suggestions?
Here is the code:
Sub PrintAllWorkbooks()
'Step 1:Declare your variables
Dim MyFiles As String
'Step 2: Specify a target folder/directory
MyFiles = Dir("mylink\*.xls*")
Do While MyFiles <> ""
'Step 3: Open Workbooks one by one
Workbooks.Open "\\us108fp00\data\Krshare\QIP conversions\PrintQIPTempFile\" & MyFiles
'ActiveWorkbook.Sheets("Sheet1").PrintOut Copies:=1
Dim sht
Dim ShtName
ShtName = Array("Revision History")
For I = 1 To Worksheets.Count
For J = 0 To UBound(ShtName)
If Worksheets(I).Name = ShtName(J) Then Count = 1
Next J
If Count = 0 Then Worksheets(I).PrintOut copies:=1
Count = 0
Next I
ActiveWorkbook.Close SaveChanges:=False
'Step 4: Next File in the Directory
MyFiles = Dir
Loop
End Sub
Bookmarks