ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using a modeless form to show status (https://www.excelbanter.com/excel-programming/442944-using-modeless-form-show-status.html)

[email protected]

Using a modeless form to show status
 
Rather than use the status bar, I displayed a modeless form with just a
label control. During the execution of a ton of code operating on a ton of
data, I periodically wrote text to the control telling how far computation
had progressed. It all seemed to work, except that the area where the
label was was whit and no text showed up. When computation was complete
and I stopped updating the control, the last message I had sent displayed
correctly.

Is there any way to use a user form (or anything similar) to display a
rapidly changing message during execution?

Thanks.

OssieMac

Using a modeless form to show status
 
Hi,

The following simple example worked OK using Repaint. However, if I inserted
the following line inside the If/End If then it did not work.
Me.Label1.Caption = i

Private Sub CommandButton1_Click()
Dim i As Long

For i = 1 To 100000
Me.Label1.Caption = i
If i Mod 1000 = 0 Then
Me.Repaint
End If
Next i

End Sub


The following code did NOT work and I have no idea why.

Private Sub CommandButton2_Click()
Dim i As Long

For i = 1 To 100000
If i Mod 1000 = 0 Then
Me.Label1.Caption = i
Me.Repaint
End If
Next i

End Sub

--
Regards,

OssieMac


" wrote:

Rather than use the status bar, I displayed a modeless form with just a
label control. During the execution of a ton of code operating on a ton of
data, I periodically wrote text to the control telling how far computation
had progressed. It all seemed to work, except that the area where the
label was was whit and no text showed up. When computation was complete
and I stopped updating the control, the last message I had sent displayed
correctly.

Is there any way to use a user form (or anything similar) to display a
rapidly changing message during execution?

Thanks.
.


[email protected]

Using a modeless form to show status
 
Ahh - Repaing - that was what I needed. Thanks!

On Fri, 28 May 2010 23:28:01 -0700, OssieMac
wrote:

Hi,

The following simple example worked OK using Repaint. However, if I inserted
the following line inside the If/End If then it did not work.
Me.Label1.Caption = i

Private Sub CommandButton1_Click()
Dim i As Long

For i = 1 To 100000
Me.Label1.Caption = i
If i Mod 1000 = 0 Then
Me.Repaint
End If
Next i

End Sub


The following code did NOT work and I have no idea why.

Private Sub CommandButton2_Click()
Dim i As Long

For i = 1 To 100000
If i Mod 1000 = 0 Then
Me.Label1.Caption = i
Me.Repaint
End If
Next i

End Sub




All times are GMT +1. The time now is 05:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com