2017-07-27 100 views
0

我正在處理一個轉發郵件的腳本,如果收件人,發件人和主題都是正確的。例如。如果一切屬實如果對多個條件的聲明

郵件轉發:

這是我目前的腳本

Public Sub FW(olItem As Outlook.MailItem) 

Dim Msg As Outlook.MailItem 
Set Msg = Item 

    If Msg.SenderEmailAddress = "[email protected]" Then 
    ElseIf Msg.To = "[email protected]" Then 
    ElseIf Msg.Subject = "Hallo" Then 
    ElseIf Msg.Subject = "Hi" Then 

     Dim olForward As Outlook.MailItem 
     Set olForward = olItem.Forward 

     With olForward 
      'Stuff happens here that work properly 
     End With 

    End If  

    '// Clean up 
    Set olItem = Nothing 
    Set olForward = Nothing 
    Set Msg = Nothing 
End Sub 
+1

不能,你只需爲這麼簡單的事情設置一個收件箱規則? – braX

回答