如果要在用户不需要交互的情况下显示消息,可以创建用户表单并将其显示为无模式,这意味着在显示表单后,VBA的正常执行将继续.
示例(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
Run Code Online (Sandbox Code Playgroud)
其次,您可以使用Excel在Excel应用程序窗口底部的状态栏区域中显示文本
Application.StatusBar = "My bottom line message to you"
Run Code Online (Sandbox Code Playgroud)