PDA

View Full Version : VBA Macro Progress Message



hobbiton73
04-23-2015, 01:08 AM
Good morning, I wonder whether someone can help.

I'm trying to implement the 'Status Bar' message found on the KB here:http://www.vbaexpress.com/kb/getarticle.php?kb_id=592 by incorporating this code into it:


'******My Existing Script******
iRow = 20
fPath = "\\c\s\CAF1\Dragon Mentor Group\Dragon Scripts\Current\April 2015"
If fPath <> "" Then
Set FSO = New Scripting.FileSystemObject
If FSO.FolderExists(fPath) <> False Then
Set SourceFolder = FSO.GetFolder(fPath)
IsSubFolder = True
Call DeleteRows
If AllFilesCheckBox.Value = True Then
Call ListFilesInFolder(SourceFolder, IsSubFolder)
Call ResultSorting(xlAscending, "C20")
Call FormatCells
Else
Call ListFilesInFolderXtn(SourceFolder, IsSubFolder)
Call ResultSorting(xlAscending, "C20")
Call FormatCells
End If
lblFCount.Caption = iRow - 20
End If
End If


The problem I've got is that when I've replaced this piece of code


'Dummyloop below to waste time, replace it with your code
MyTimer = Timer
Do
Loop While Timer - MyTimer < 0.03


with my code as per the instructions the code contantsly runs and doesn't update the progress bar, and I'm not sure where I've gone wrong.

I just wondered whether someone may be able to look at this please and let me know where I've gone wrong.

Many thanks and kind regards