Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print multiple excel files with multiple tabs without opening excel

Status
Not open for further replies.

GUEdiver246

Technical User
Oct 22, 2020
1
US
I currently have a working file to print a single excel file with multiple tabs. I need to modify it to print multiple excel files within the single folder. My folder contains 5 excel files with .xlsx extension and a few other files that I do not want to print. The folder might end up renamed or moved. I need it to continue working if that happens. Thank you for any help you can provide.

set shApp = CreateObject("shell.application")
currentPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")
set shFolder = shApp.NameSpace( currentPath )
Set oExcel = CreateObject("Excel.Application")
oExcel.Visible = False
oExcel.Workbooks.Open currentPath & " \ " & "AHT CDE Fluid Tracking.xlsx"
oExcel.Workbooks(1).Sheets.PrintOut
oExcel.Workbooks.Close
oExcel.Quit
Set shApp = Nothing
Set shFolder = Nothing
Set oExcel = Nothing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top