

' This section is where you can use your own ' Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)īar1.Tag = Bar1.Width ' Memorize initial/maximum width
Wondershare safeeraser progress bar software#
' remove after software testing is complete ' This is used to create a delay to prevent memory overflow
Wondershare safeeraser progress bar code#
Then add this code to UserForm1: = Attach the following code to UserForm1 = Sample Usage: Dim progressBar As New ProgressBarĬall progressBar.Update(i, 100, "My Message Here", True)Īpplication.Wait (Now + TimeValue("0:00:01"))ĭisplay the integers used to drive the progress bar If Len(display) > MAX_LENGTH Then display = Right(display, MAX_LENGTH) ' chop off to the maximum length if necessary If DisplayPercent = True Then display = display & " (" & Value & "%) " ' Closing character to show end of the bar If MaxValue > 0 Then Value = WorksheetFunction.RoundUp((Value * 100) / MaxValue, 0)ĭisplay = display & String(Int(Value / (100 / NUM_BARS)), BAR_CHAR)ĭisplay = display & String(NUM_BARS - Int(Value / (100 / NUM_BARS)), SPACE_CHAR) ' If the maximum is set then adjust value to be in the range 0 to 100 If Value 100 And MaxValue = 0) Then Exit Sub ' DisplayPercent : Display the percent complete after the status bar ' Status : optional message to display for user Optional ByVal DisplayPercent As Boolean = True) ' set the progress bar chars (should be equal size)Īpplication.DisplayStatusBar = statusBarStateĪpplication.ScreenUpdating = screenUpdatingStateĪpplication.EnableEvents = enableEventsState ScreenUpdatingState = Application.ScreenUpdating StatusBarState = Application.DisplayStatusBarĮnableEventsState = Application.EnableEvents ' Save the state of the variables to change Private Const MAX_LENGTH As Integer = 255 Once the object goes out of scope it will automatically clean up and release the StatusBar back to Excel. Also by using a class, you can set it up to handle initializing and releasing the StatusBar automatically.

You can set the length of the bar by changing NUM_BARS. Just select one according to how much space you want to show between the bars. 9608 - 9615 are the codes I tried for the bars.

Here's another example using the StatusBar as a progress bar.īy using some Unicode Characters, you can mimic a progress bar.
