2017-05-24 12 views
0

Outlookでは、メッセージを一時的に表示するために次のコードを設定しました。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 
+1

に動作しますが、あなたが望むものをもう少し正確に説明していただけますか?何が効いていないのですか? –

+0

(1)どこからメッセージを渡しますか?誰が知っているか知らない電子メールは転送されません。 (2)VBAのMsgBoxを使ってメッセージを表示していないのはなぜですか?正当な理由があるかもしれませんが、あなたの質問からは分かりません。 –

+0

2.マクロを設定して10分ごとに実行し、その時点でOutlookで作業しているとマクロが実行されていることをユーザーに知らせる必要があります。 –

答えて

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 
+0

私は自分のマクロを更新しました。ポップアップが関連するテキストとともに表示され、消えています。 –

関連する問題