I've searched around (for hours!), the next is the best I've been able to come up with. It fails with Runtime error 1004 "Application-defined or object-defined error" at the Set WaitBox statement. Is this not available in Excel 2000?
The purpose is to create a "wait" message at the start of a long running process. WaitSheetName and WaitBoxName are public, defined in my module of all Public variables, to be used by the second sub, called when the process has ended, to destroy the message.
[The final will be a bit more elegant with the box parameters set to center it in the window, round the corners, etc.]
The purpose is to create a "wait" message at the start of a long running process. WaitSheetName and WaitBoxName are public, defined in my module of all Public variables, to be used by the second sub, called when the process has ended, to destroy the message.
[The final will be a bit more elegant with the box parameters set to center it in the window, round the corners, etc.]
Code:
Sub PleaseWait(Optional TopMessage As Variant)
Dim WaitMessage As String, WaitSheet As Worksheet, WaitBox As Shape
WaitMessage = ""
If Not IsMissing(TopMessage) Then WaitMessage = TopMessage & vbCrLf
WaitMessage = WaitMessage & "Please wait . . ."
Set WaitSheet = ActiveSheet
WaitSheetName = ActiveSheet.Name
Set WaitBox = WaitSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, _
215, 195, 90, 60)
WaitBox.TextFrame.Characters.Text = WaitMessage
WaitBoxName = WaitBox.Name
End Sub
Sub EndWait()
If WaitBoxName <> "" Then
Sheets(WaitSheetName).TextBoxes(WaitBoxName).Delete
WaitBoxName = ""
End If
End Sub