View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Macro Message Box

Hi,

AFAIK message boxes are modal so you can't do that but you can do it with a
userform. Create a userform and put a text box on it and include this line in
you code at the appropriate point. Note the declaration of Mytext as Public

Public MyText As String
Sub YourSub()
'Your Code
MyText = "An informative message"
UserForm1.Show
End Sub

Attach this code to the userform and it will display your message and close
after 10 seconds.

Private Sub UserForm_Activate()
TextBox1.Text = MyText
Application.Wait (Now + TimeValue("0:00:10"))
Unload UserForm1
End Sub



--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"lahuwm" wrote:

Hi, I am trying to build a macro for a histogram. When the macro is complete,
I am asked "Histogram - Some data will be hidden by embedded chart(s)." I
can click OK or cancel. How can I build my OK response into the macro so
that I do not need to manually respond? Thank you for reviewing my question.