W wdegler Active Member Licensed User Longtime User Oct 6, 2011 #1 I have a sub in a code module which needs to show progress when executing. It is not practical to put the sub into the Activity module (which is bloated already). How can I have a progress bar updating as a loop in the code module sub iterates? A trivial example follows: 'The Activity module: Sub Process_Globals End Sub Sub Globals End Sub Sub Activity_Create(FirstTime As Boolean) 'do things here Module1.ALongOne 'and here End Sub Sub Activity_Resume End Sub Sub Activity_Pause (UserClosed As Boolean) End Sub 'The Code module (Module1): Sub Process_Globals End Sub Sub ALongOne Dim I As Int For I=1 To 100000 'do things here, like updating a progress bar in each iteration Next End Sub How can I make a progress bar work for a sub in a code module?
I have a sub in a code module which needs to show progress when executing. It is not practical to put the sub into the Activity module (which is bloated already). How can I have a progress bar updating as a loop in the code module sub iterates? A trivial example follows: 'The Activity module: Sub Process_Globals End Sub Sub Globals End Sub Sub Activity_Create(FirstTime As Boolean) 'do things here Module1.ALongOne 'and here End Sub Sub Activity_Resume End Sub Sub Activity_Pause (UserClosed As Boolean) End Sub 'The Code module (Module1): Sub Process_Globals End Sub Sub ALongOne Dim I As Int For I=1 To 100000 'do things here, like updating a progress bar in each iteration Next End Sub How can I make a progress bar work for a sub in a code module?
agraham Expert Licensed User Longtime User Oct 6, 2011 #2 Pass the ProgressBar in as a parameter to the Sub and use DoEvents in your loop. Upvote 0
W wdegler Active Member Licensed User Longtime User Oct 6, 2011 #3 This works! This works! Thank you. Upvote 0