在Outlook中,我已设置以下代码以临时显示消息。
但是我无法确定如何传递包含要显示的文本的变量(aMessageLabel
)。
Sub Test()
Dim aShell
Set aShell = CreateObject("WScript.Shell")
aMessageLabel = Chr(34) & "No Emails to be Forwarded!" & Chr(34)
aShell.Run "mshta.exe vbscript:close(CreateObject(""WScript.shell"").Popup(aMessageLabel,5,""Message""))"
End Sub
答案 0 :(得分:0)
这是有效的
Sub Test()
' this is the resulting windows command (you can run at command prompt)
' mshta.exe vbscript:close(CreateObject("WScript.shell").Popup("No Emails to be Forwarded!",5,"Message"))
' the "5" is number of seconds that the popup message will live
Dim aShell
Set aShell = CreateObject("WScript.Shell")
aMessageLabel = "No Emails to be Forwarded!"
Dim cmd As String
' multiline
cmd = "mshta.exe vbscript:close(CreateObject(""WScript.shell"").Popup("""
cmd = cmd & aMessageLabel
cmd = cmd & """,5,""Message""))"
Debug.Print cmd
aShell.Run cmd
' one line
aShell.Run "mshta.exe vbscript:close(CreateObject(""WScript.shell"").Popup(""" & aMessageLabel & """,5,""Message""))"
End Sub