qwer11121
qwer11121

Reputation: 168

How to display "Updating Workflow Status" progress bar in Excel status bar in VSTO?

I need a indicator in Excel VSTO to let user know the background task is running, and I'd like to use Excel native progressbar like this:

enter image description here

Does anyone know how to show and hide this in VSTO? Thank you.

Upvotes: 1

Views: 1675

Answers (1)

Eugene Astafiev
Eugene Astafiev

Reputation: 49395

There is no trivial way to customize the status bar with a progress bar...

The Application.StatusBar property allows setting a custom text in the status bar, but not a progress bar. This property returns false if Microsoft Excel has control of the status bar. To restore the default status bar text, set the property to false - this works even if the status bar is hidden.

oldStatusBar = Application.DisplayStatusBar 
Application.DisplayStatusBar = True 
Application.StatusBar = "Please be patient..." 
Workbooks.Open filename:="LARGE.XLS" 
Application.StatusBar = False 
Application.DisplayStatusBar = oldStatusBar

If you want to display a progress bar with some text I'd suggest using task panes for that. Read more about that in the How to: Add a custom task pane to an application article. On the user control you are free to use any .net controls.

Upvotes: 2

Related Questions