View Full Version : [SOLVED:] Print Macro
I need a macro that will print all the sheets in all the workbooks in a particular folder. I am also going to assign the macro to a button on a worksheet in that same folder.
:dunno
Thx,
mvidas
06-07-2005, 01:18 PM
Kane,
Are you looking for something like this?
Sub KanePrintAllWorksheetsOnWorkbooksInFolder()
Dim vFolder As String, vFile As String, WB As Workbook, WS As Worksheet
vFolder = "C:\temp\"
vFile = Dir(vFolder)
Application.ScreenUpdating = False
Do Until vFile = ""
If LCase(Right(vFile, 3)) = "xls" And vFile <> ThisWorkbook.Name Then
Set WB = Workbooks.Open(vFolder & vFile)
For Each WS In WB.Sheets
WS.PrintOut
Next WS
WB.Close False
End If
vFile = Dir()
Loop
Application.ScreenUpdating = True
End Sub
Should do the trick!
Matt
Hey, I think this is what I'm after.
Can you make it so VFolder is the folder that my main workbook is in, because this folder will be transfered from computer to computer and each with a different file path.
Thanks,
Jacob Hilderbrand
06-07-2005, 01:51 PM
vFolder = ThisWorkbook.Path & "\"
mvidas
06-07-2005, 02:00 PM
Thanks Jake!
Got it, everything working good now.
Thx very much,
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.