vbanoob1234
New Member
- Joined
- Aug 8, 2016
- Messages
- 26
Hi everyone,
My macro currently opens up all of the excel files in a certain path on my computer, and prints all visible sheets, single sided.
However, I want to fine tune my macro.
I have a bunch of hidden and very hidden sheet. I only want to print ALL of visible sheets, except for ones with the Worksheet Name "Master" "Deal" "Summary".
Also, I want to print all these sheets doubled side.
Sub PrintAll()
' Printsheets Macro
Dim wb As Workbook, ws As Worksheet
Dim sFil As String, sPath As String
Set wb = ActiveWorkbook
Set ws = ActiveSheet
Application.ScreenUpdating = False
'OPENS THE PATH
sPath = "P:\VBA" 'location of files, don't forget the "" at the end
sFil = Dir(sPath & "*.xls") 'change or add formats
Application.DisplayAlerts = False
'FIND ALL THE FILES TO PRINT
Do Until sFil = ""
Workbooks.Open sPath & sFil
Set wb = ActiveWorkbook
Application.ScreenUpdating = False
'PRINTS OUT ALL VISIBLE SHEETS
'ws.PrintOut
For Each ws In wb.Worksheets
If ws.Visible = xlSheetVisible Then ws.PrintOut
Next
wb.Close
sFil = Dir()
Loop
Application.DisplayAlerts = True
End Sub
My macro currently opens up all of the excel files in a certain path on my computer, and prints all visible sheets, single sided.
However, I want to fine tune my macro.
I have a bunch of hidden and very hidden sheet. I only want to print ALL of visible sheets, except for ones with the Worksheet Name "Master" "Deal" "Summary".
Also, I want to print all these sheets doubled side.
Sub PrintAll()
' Printsheets Macro
Dim wb As Workbook, ws As Worksheet
Dim sFil As String, sPath As String
Set wb = ActiveWorkbook
Set ws = ActiveSheet
Application.ScreenUpdating = False
'OPENS THE PATH
sPath = "P:\VBA" 'location of files, don't forget the "" at the end
sFil = Dir(sPath & "*.xls") 'change or add formats
Application.DisplayAlerts = False
'FIND ALL THE FILES TO PRINT
Do Until sFil = ""
Workbooks.Open sPath & sFil
Set wb = ActiveWorkbook
Application.ScreenUpdating = False
'PRINTS OUT ALL VISIBLE SHEETS
'ws.PrintOut
For Each ws In wb.Worksheets
If ws.Visible = xlSheetVisible Then ws.PrintOut
Next
wb.Close
sFil = Dir()
Loop
Application.DisplayAlerts = True
End Sub