This example create a modeless message box with a thermometer and a Cancel button. This example also shows how to process the clicking of the Cancel button.
Sub Main()
On Error Goto ErrorTrap
Msg.Open "Reading records from file...",0,True,True
For i = 1 To 100 'Read a record here.
'Update the modeless message box.
Msg.Thermometer =i
DoEvents
Sleep 50
Next i
Msg.Close
On Error Goto 0 'Turn error trap off.
Exit Sub
ErrorTrap:
If Err = 809 Then
MsgBox "Cancel was pressed!"
Exit Sub 'Reset error handler.
End If
End Sub
|