Application.StatusBar
-
- 5StarLounger
- Posts: 1185
- Joined: 24 Jan 2010, 12:02
- Location: Wales, UK.
Application.StatusBar
I ran a macro earlier that contained the following:
Application.StatusBar = "This is a message."
Where is the benefit of using the status bar for displaying a message? (I cannot think of one), and at what point does it "go away"?
Application.StatusBar = "This is a message."
Where is the benefit of using the status bar for displaying a message? (I cannot think of one), and at what point does it "go away"?
Nathan
There's no place like home.....
There's no place like home.....
-
- Administrator
- Posts: 78631
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Application.StatusBar
You can use it to keep the user informed of the progress of your macro in an unobtrusive way.
For example, I have an Excel "application" with a macro that performs a large number of validity checks for each row of a worksheet. If the sheet has many rows, this may take a while, so I use code like this:
The text will remain displayed until you explicitly change or clear it, or until you do something that causes Excel to display something in the status bar.
For example, I have an Excel "application" with a macro that performs a large number of validity checks for each row of a worksheet. If the sheet has many rows, this may take a while, so I use code like this:
Code: Select all
m = ... ' last used row
For r = 2 To m
Application.StatusBar = "Checking row " & r " & " of " & m
' Validity checks
...
Next r
Application.StatusBar = ""
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 1185
- Joined: 24 Jan 2010, 12:02
- Location: Wales, UK.
Re: Application.StatusBar
Thankyou Hans, your explanation makes perfect sense, and I can see the benefit of using code in that way. That will be very useful.
Nathan
There's no place like home.....
There's no place like home.....
-
- 5StarLounger
- Posts: 1185
- Joined: 24 Jan 2010, 12:02
- Location: Wales, UK.
Re: Application.StatusBar
Hans,
I have found this concept to be extremely useful, Thankyou very much!
One issue that I have is that when I use:
Application.StatusBar = ""
at the end of the process, my normal status bar messages (like saving progress bar) disappear for a while, and there is no telling when normality may return.
Any thoughts?
I have found this concept to be extremely useful, Thankyou very much!
One issue that I have is that when I use:
Application.StatusBar = ""
at the end of the process, my normal status bar messages (like saving progress bar) disappear for a while, and there is no telling when normality may return.
Any thoughts?
Nathan
There's no place like home.....
There's no place like home.....
-
- Administrator
- Posts: 78631
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
-
- 5StarLounger
- Posts: 1185
- Joined: 24 Jan 2010, 12:02
- Location: Wales, UK.
-
- 5StarLounger
- Posts: 1185
- Joined: 24 Jan 2010, 12:02
- Location: Wales, UK.
!
.......Back again
I am finding the concept of using the statusbar to relay messages extremely useful in long running sections of code!
I use:
Application.statusbar = "" to relay a message
&
Application.statusbar = False - to reset the statusbar back to normality, which generally works well.
I am having a small issue whereby I am resetting the s/b to false immediately prior to workbook save commands, where I want to see the saving progress bar. However, this does not show.
Would this be a timing issue? or..... ? Any suggested workarounds?
I am finding the concept of using the statusbar to relay messages extremely useful in long running sections of code!
I use:
Application.statusbar = "" to relay a message
&
Application.statusbar = False - to reset the statusbar back to normality, which generally works well.
I am having a small issue whereby I am resetting the s/b to false immediately prior to workbook save commands, where I want to see the saving progress bar. However, this does not show.
Would this be a timing issue? or..... ? Any suggested workarounds?
Nathan
There's no place like home.....
There's no place like home.....
-
- Administrator
- Posts: 78631
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Application.StatusBar
Try inserting a line
DoEvents
after setting StatusBar to False.
DoEvents
after setting StatusBar to False.
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 1185
- Joined: 24 Jan 2010, 12:02
- Location: Wales, UK.
Re: Application.StatusBar
That does not work.
Any other idea's? Thanks for looking.
Code: Select all
Application.StatusBar = "xyz"
..... more code
Application.StatusBar = False
DoEvents
ActiveWorkbook.SaveAs Filename:=strPath4 & "xyz" & Format(strDate, "dd.mmm.yy") & ".xls"
ActiveWindow.Close
Nathan
There's no place like home.....
There's no place like home.....
-
- Administrator
- Posts: 78631
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Application.StatusBar
In that case, I don't think you can do anything about it.
Best wishes,
Hans
Hans
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: Application.StatusBar
VegasNath,VegasNath wrote:That does not work.
Any other idea's? Thanks for looking.
Are you refering to the save progress as in the attached picture.
If this is the case, I created code that alters the statusbar, then reset it to False (without DoEvents), and it showed the status of saving the file? Let me know if I am misunderstanding your query??
You do not have the required permissions to view the files attached to this post.
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.
-
- 5StarLounger
- Posts: 1185
- Joined: 24 Jan 2010, 12:02
- Location: Wales, UK.
Re: Application.StatusBar
Hi Rudi,
Yes, it is the save progress bar that I want to show, but it is not showing even after resetting the s/b to false, prior to the save command.
Neither Doevents or Application.wait makes a difference.
Yes, it is the save progress bar that I want to show, but it is not showing even after resetting the s/b to false, prior to the save command.
Neither Doevents or Application.wait makes a difference.
Nathan
There's no place like home.....
There's no place like home.....
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: Application.StatusBar
The only thing I can think of is that your file is being saved so quickly that the progress bar does not get time to show. In my example (where I made that screen print), I created a file that was 10000 rows in length and it took about 5 seconds to save. The code is no different to yours where I simply reset the S/B. Maybe your file is too small and the save process is too quick.VegasNath wrote:Yes, it is the save progress bar that I want to show, but it is not showing even after resetting the s/b to false, prior to the save command.
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.
-
- PlutoniumLounger
- Posts: 15655
- Joined: 24 Jan 2010, 23:23
- Location: brings.slot.perky
Re: Application.StatusBar
Try also:VegasNath wrote:Application.StatusBar = "This is a message."
Code: Select all
Application.Caption = "This is a message."
He who plants a seed, plants life.
-
- 5StarLounger
- Posts: 1185
- Joined: 24 Jan 2010, 12:02
- Location: Wales, UK.
Re: Application.StatusBar
No worries, this is annoying, but it's not a show stopper. Thanks all.
Nathan
There's no place like home.....
There's no place like home.....