![]() |
Loop through open workbooks
For Each WB In Workbooks Debug.Print WB.Name Next WB -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Dan" wrote in message ... Hello What code would I use to loop through all open workbooks, or all files in a dir names filex****. Thanks! |
Loop through open workbooks
Thank you
|
Loop through open workbooks
Hello,
Here is an idea for the second question: Option Explicit Public Sub LoopFiles() Dim sStart As String ' sStart = InputBox("Where to start", "Find Files in folder", "C:\My Documents") loopTree (sStart) End Sub Private Sub loopTree(ByVal sStart As String) Dim sFound As String ' sFound = Dir(sStart & "\*.*") Do While sFound < "" If (GetAttr(sStart & "\" & sFound) And vbDirectory) = vbDirectory Then loopTree (sStart & "\" & sFound) Else Debug.Print sStart & "\" & sFound End If sFound = Dir() Loop End Sub Good Luck, Wouter HM. "Bob Phillips" wrote in message ... For Each WB In Workbooks Debug.Print WB.Name Next WB -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Dan" wrote in message ... Hello What code would I use to loop through all open workbooks, or all files in a dir names filex****. Thanks! |
All times are GMT +1. The time now is 01:36 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com