Message alert other than MsgBox in Excel?

Moritz Schmitz v. Hülst picture Moritz Schmitz v. Hülst · Apr 9, 2015 · Viewed 9.2k times · Source

Is there another way to display messages in Excel other than the MsgBox?

I was thinking of the security alert/enable macros alert style. Can I use that same space to display some text?

I am trying to notify users without them needing to click a button.

Answer

MikeD picture MikeD · Apr 9, 2015

If you want to display messages without the user needing to interact, you can create a user form and display it modeless, meaning that after displaying the form the normal execution of your VBA continues.

example (form = "UserMsgBox", label = "Label1")

Sub Test()
    UserMsgBox.Show vbModeless

    UserMsgBox.Label1.Caption = "This is my 1st message to you"
    UserMsgBox.Repaint
    Application.Wait Now + TimeValue("00:00:02")

    UserMsgBox.Label1.Caption = "This is my 2nd message to you"
    UserMsgBox.Repaint
    Application.Wait Now + TimeValue("00:00:02")

    UserMsgBox.Label1.Caption = "This is my 3rd and last message to you"
    UserMsgBox.Repaint
    Application.Wait Now + TimeValue("00:00:02")

    UserMsgBox.Hide

End Sub

Secondly you can display text in the status bar area in the bottom of the Excel application window by using

Application.StatusBar = "My bottom line message to you"