Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Message alert other than MsgBox in Excel?

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.

like image 458
Moritz Schmitz v. Hülst Avatar asked Mar 16 '23 11:03

Moritz Schmitz v. Hülst


1 Answers

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"
like image 194
MikeD Avatar answered Mar 24 '23 18:03

MikeD