I've found a lot to this in many places but nothing really comprehensive and thus have made an effort to implement a common solution in a class module called clsMSBPrgrs which can be found in the Workbook ASBPrgrs.xlsm. It is able to display the progress of any number of sequentially called or nested processes (usually loops of any kind), either together with a variable that illustrates the progress or, if there is none sensible variable, to automatically display dots instead.
Calling the progress display is just one statement like:wherby i may be the loop iterator. The .Dsply method of the class ensures the update of the Application.StatusBar even for very long processes with thousands of iterations. The class has several properties to "configure" the progress display before it is used the first time which looks as follows:![]()
cMSBPrgrs.Dsply "MyProcess", i
If this sounds interesting I would be happy for any reply regarding its usefullness (once it has been tried of course). In case any help for using/integrating it in your project, please let me know.![]()
With cASBPrgrs .MainProcess = "xxxxx" ' Names the main process of which the progress is displayed .MaxSubProcesses = 5 ' Limits the number of displayed sub-processes by dropping olders .MaxMsgLen = 150 ' Limits the lenght of the message which is adjusted intelligently when exeeded .MsecToNextDsply = 200 ' Avoids a possible performance loss caused by DoEvents, which is used to ensure a frequent message update End With
P.S.: The Workbook ASBPrgrs.xlsm also features a performance test and demo.
Bookmarks