Printing - Various Workbooks/Worksheets

  • Thread starter Thread starter sosteffo
  • Start date Start date
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
 
Hi sosteffo

Do you know the name of each sheet you want to print in
each workbook?
 
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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top