This is an easy to use VBA userform for visualizing macro progress.
- Download source files from \src directory (
frmProgressbar.frm
and.frx
) and save in the same local directory - From the Visual Basic Editor import
frmProgressbar.frm
(the.frx
file with automatically come with it)
Like most forms:
frmProgressBar.Show
to show the progress bar.
Unload frmProgressBar
to close the progress bar when you're done with it.
frmProgressBar.Hide
to temporarily hide the progress bar but keep the changes.
There are 3 methods to update the appearance of the progress bar:
frmProgressBar.Progress
frmProgressBar.Recaption
frmProgressBar.SetBarColor
This method updates the length of the bar and can update the caption at the same time. Intended to be used in a loop.
Arguments:
currentItem
: The current iteration numbertotalItems
: The total iteration countstrUpperText
: Optional string for the upper captionstrLowerText
: Optional string for the lower caption
This method only updates the captions, but does not affect the progress bar itself.
Arguments:
strUpperText
: Optional string for the upper captionstrLowerText
: Optional string for the lower caption
If no argument is provided the caption will remain unchanged. Provide a null string if you want the caption to be blank.
This method changes the color of the progress bar. Colors codes can be determined here.
The method can accept colors as hex codes in the format &H00000000&
or from the RGB(255,255,255) function.
Arguments:
barColor
- Optional Value representing desired progress bar color.
If the method is used and no barColor
value is provided, the progress bar will default back to light green.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.