Vba excel status bar not updating
B) Is there a way to prevent Screen Updates from getting turned back "on" by Do Events?C) How do you manually break code running with Do Events in it?
' Class Module - Progress Bar Option Explicit Private status Bar State As Boolean Private enable Events State As Boolean Private screen Updating State As Boolean Private Const NUM_BARS As Integer = 50 Private Const MAX_LENGTH As Integer = 255 Private BAR_CHAR As String Private SPACE_CHAR As String Private Sub Class_Initialize() ' Save the state of the variables to change status Bar State = Application. Enable Events = False End Sub Private Sub Class_Terminate() ' Restore settings Application. Screen Updating = screen Updating State Application. Status Bar = False End Sub Public Sub Update(By Val Value As Long, _ Optional By Val Max Value As Long= 0, _ Optional By Val Status As String = "", _ Optional By Val Display Percent As Boolean = True) ' Value : 0 to 100 (if no max is set) ' Value : 0 Then Value = Worksheet Function. Width = 0 End Sub Sub Progress Bar Demo() Dim int Index As Integer Dim sng Percent As Single Dim int Max As Integer '============================================== '====== Bar Length Calculation Start ========== '-----------------------------------------------' ' This section is where you can use your own ' ' variables to increase bar length.I traced the issue to a spot in the macro where I run an executable using: It appears that calling the executable disrupted the status bar display and excel reverted to displaying whatever status bar message was showing before screen updating was disabled. Calculation = xl Calculation Manual 'Your Code Here Application. As I've used 2013 more, it seems like Status Bar will serve for smaller macros that don't need to update much and don't handle much data, but just isn't up to the job for bigger programs anymore.I ran into a similar problem today so I thought I would share what I found while debugging the issue: For me I noticed that the status bar was reverting to a previous status bar method while my macro was running.
Here is a simple code which gives a message box showing the values in column A starting from row 2 to the last row.