在Excel中MsgBox以外的消息警报?

有没有另一种方式来显示消息Excel以外的MsgBox?

我正在考虑安全警报/启用macros警报样式。 我可以使用相同的空间来显示一些文字吗?

我试图通知用户,他们不需要点击一个button。

干杯

如果您想显示消息而无需用户进行交互,则可以创build一个用户表单并将其显示为非模式 ,这意味着在显示表单之后,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 

其次,您可以使用在Excel应用程序窗口底部的状态栏区域显示文本

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

我宁愿与OnTime一起安排任务而不是使用Wait。 等待可能会阻止所有其他Excel活动。 所以,用户必须等待,直到表单不见了。 与OnTime用户仍然可以select做一些事情在此期间。 所以,这是我的命题(也使用Form方法):

 Public Sub showform() Load UserForm1 UserForm1.StartUpPosition = 0 UserForm1.Left = Application.Left + Application.Width * 0.9 - UserForm1.Width UserForm1.Top = Application.Top + Application.Height * 0.9 - UserForm1.Height UserForm1.Show (False) Application.OnTime Now + TimeValue("0:00:05"), "closeform" End Sub Public Sub closeform() UserForm1.Hide Unload UserForm1 End Sub 

在回答这个问题的时候请看下面的链接列出所有types的msgbox

下面的语法也使用 – 希望这有助于!

 MsgBox("Some Text", vbCritical, "Message title") 

https://msdn.microsoft.com/en-us/library/139z2azd%28v=vs.90%29.aspx

干杯

您可以使用这种types的消息框,而不是默认的VBA MsgBox。 它支持Unicode

 Application.Assistant.DoAlert "Hoc Excel Online Title", "your message", 0, 4, 0, 0, 0 
Interesting Posts