Printing - Various Workbooks/Worksheets

S

sosteffo

I need to print sheets from around 25 workbooks in excel, this can b
pretty time consuming.....the problem is i found a macro that woul
print the first sheet in all the workbooks, whithin a folder.... i nee
to specify which sheet i need printing, i.e some workbooks have severa
sheets
 
R

Ron de Bruin

Hi sosteffo

Do you know the name of each sheet you want to print in
each workbook?
 
R

Ron de Bruin

Hi sosteffo

If you know the names you can use this for example
Add all the workbook nmaes and sheet names to the Array

sheet1 from ron1.xls will print
sheet2 from ron2.xls ....
sheet3 from ron3.xls....
sheet4 from ron4.xls...

WbName = Array("ron1.xls", "ron2.xls", "ron3.xls", "ron4.xls")
Shname = Array("Sheet1", "Sheet2", "Sheet3", "Sheet4")


Sub Print_test()
Dim wb As Workbook
Dim Shname As Variant
Dim WbName As Variant
Dim Path As String
Dim N As Integer

Path = "C:\Data\"
WbName = Array("ron1.xls", "ron2.xls", "ron3.xls", "ron4.xls")
Shname = Array("Sheet1", "Sheet2", "Sheet3", "Sheet4")

Application.ScreenUpdating = False
For N = LBound(WbName) To UBound(WbName)
Set wb = Workbooks.Open(Path & WbName(N))
wb.Sheets(Shname(N)).PrintOut
wb.Close False
Next N
Application.ScreenUpdating = True
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


Ron de Bruin said:
Hi sosteffo

Do you know the name of each sheet you want to print in
each workbook?
 
Top