VBA- msgbox- changing txt- forms

Hi All-
hoping someone can help me with a VBA question...

I am running some code which takes some time to run.

I want to show a message to the user which says something like->
"finished running XXX"
"finished running YYY"
as the code runs through the loops/subs/etc.

MsgBox can't do this because it is a one shot deal, right? i.e. you show your text and are stuck with it.

Forms seem problematic because code doesn't run in the background while they are being shown right (unless you call the code from the form).

Any simple solutions? Something like a msgbox that wouldn't pause code execution, but would allow me to change the text it was showing from time to time would be great!

Thanks!
quanttrade  
tobal99zAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
try
yourform.show vbModeless

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Priest04Commented:
You could do something like creating custom messagebox (which is quite simple), and display it modelles, as angel suggested.... Or you can have some notification area on the form that is executeing this code. Somethinf like


Task 1 ,,,,,,,,,,,,,,,,,,,,,,,, done
Task 2 ,,,,,,,,,,,,,,,,,,,,,,,, done
Task 3 ,,,,,,,,,,,,,,,,,,,,,,,, executing
Task 4 ,,,,,,,,,,,,,,,,,,,,,,,,
Shane Russell2nd Line Desktop SupportCommented:
Why not just make a label somewhere on the form that updates dynamically so that as it is doing it , it changes the labels caption ie :

Task 1 ............. Executing
Task2...............Waiting
Task3...............Waiting

Then once it has finished that in the loop code or where ever make it update the label and then it will say

Task1.......Done
Task2.......Executing
Task3.......Waiting
Task4........Waiting

You could even do what angel suggested with regards to a modeless form and use the label on that form and update the labels caption as per this suggestion, unless that is what Priest was reffering to ?
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Mike TomlinsonHigh School Computer Science, Computer Applications, Digital Design, and Mathematics TeacherCommented:
You can use a Label on a Form.  Just update it, call the Refresh() method and then use DoEvents to ensure the updated text is displayed:

    Form1.Label1.Caption = "something..."
    Form1.Label1.Refresh
    DoEvents
Cygnus111Commented:
Idle Mind has it right.  In your loop do the following:

For X = 1 to Y
  ** whatever process you're running **
    Form1.Label1.Caption = "Task " & X & " of " & Y & " Complete."
    Form1.Label1.Refresh
Next X

Or if you want, you can have a series of labels on the form and address them by name, so that it can show each loop and whether it's complete or not (as Gecko suggested).
Shane Russell2nd Line Desktop SupportCommented:
You dont need a series of labels or a control array from what I can tell you can just use the vbcrlf so that it just does it as per your loop ie :

For X = 1 to Y
  ** whatever process you're running **
    Form1.Label1.Caption = Form1.Label1.Caption &  "Task " & X & " of " & Y & " Complete." & vbcrlf
    Form1.Label1.Refresh
Next X

I am sure that would work. That way you only need one label, you would just have to set the auto fit / auto size property to true ( I am pretty sure that the label has that property ) If not then just set the label to be large enough to fit all the contents of it in, if that wont work then instead of using a label just use a textbox and set the locked property to true and make the multiline property true and set the scrollbars to vertical so that they can scroll up and down ( you could make that property to both if the contents of what is inside of the textbox is too much for the textbox.
Priest04Commented:
I dont see the relevance wheter it will be with label control, or listbox, or text box.... or will it display only one task at the moment, or all of them... Its up to user to choose the appropriate interface. We could end up with discussion about implementing icons as well for particular task...... And in the end tobal99z could say that he isnt fond of using a label for this purpose. :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.