How to display a message box

S

Salman

I need to have a message box that says "Please wait" show
up while code executes. Used to be a simple thing in XL97.
Please tell me how to make it show up.

Thank you.
 
C

Cesar Zapata

The best way I have found is this. Put a Image in your worksheet. and name
it Please Wait or whatever. the run this code. The way I usually do it is
I create a Userform with all the stuff I want the I take a screenshot and
paste it in my worksheet.


Dim MySel As Object




Sub Show_Please_Wait()

On Error Resume Next

Dim VR As Range, MyShape As Shape
Set VR = ActiveWindow.VisibleRange
Set MyShape = Sheet1.Shapes("PleaseWait")
Set MySel = Selection

MyShape.Copy
T = VR.Top + VR.Height / 2 - MyShape.Height / 2
L = VR.Left + VR.Width / 2 - MyShape.Width / 2

ActiveSheet.Paste
With ActiveSheet.Shapes("PleaseWait")
.Top = T
.Left = L
End With

VR.Resize(1, 1).Select

End Sub

Sub Hide_Please_Wait()

On Error Resume Next
ActiveSheet.Shapes("PleaseWait").Delete
Application.ScreenUpdating = True
MySel.Select
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top