Skip to content

Commit e21d1ab

Browse files
Updated the FindSubFilesAndFolders function to provide visual feedback via Application.StatusBar that the process is still working. Also adds DoEvents to prevent application not responding. Fixes #2
1 parent b8966e1 commit e21d1ab

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

DirectoryManager.cls

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Attribute VB_Creatable = False
88
Attribute VB_PredeclaredId = False
99
Attribute VB_Exposed = False
1010
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
11-
'Version 1.0.1 '
11+
'Version 1.0.2 '
1212
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
1313
'MIT License '
1414
' '
@@ -155,10 +155,16 @@ Private Sub FindSubFilesAndFolders()
155155
' and repeats the process.
156156
Dim item As Variant
157157
Dim newFolder As DirectoryManager
158+
Dim originalStatusBarDisplay As Boolean
158159

159-
160+
originalStatusBarDisplay = Application.DisplayStatusBar
161+
Application.DisplayStatusBar = True
160162

161163
For Each item In FoundFoldersList
164+
'For large file/folder counts, Excel appears to freeze. This gives feedback that it's still working.
165+
Application.StatusBar = "Reading from folder '" & item & "'"
166+
DoEvents
167+
162168
Set newFolder = New DirectoryManager
163169
newFolder.OmittedPrefix = OmittedPrefixValue
164170
newFolder.Path = FolderPath & item
@@ -174,6 +180,8 @@ Private Sub FindSubFilesAndFolders()
174180
InsertCollectionValueAlphabetically FoundFiles, newFolder, newFolder.Name
175181
Next item
176182

183+
Application.DisplayStatusBar = originalStatusBarDisplay
184+
177185
End Sub
178186

179187

ExampleWorkbook.xlsm

569 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)