2014-07-01 58 views
0

我有VBA代碼可以自動將所有電子郵件轉發到外部帳戶。當我點擊F5運行它時,我無法使宏顯示在宏菜單中。單擊F5時宏沒有顯示在宏菜單中

Sub AutoForwardAllSentItemsss(Item As Outlook.MailItem) 

Dim strMsg As String 
Dim autoFwd As Outlook.MailItem 
Set autoFwd = Item.forward 
autoFwd.Recipients.Add "[email protected]" 
autoFwd.Send 
Set autoFwd = Nothing 

End Sub 

回答

0

通過運行腳本選項設置規則。當你選擇一個腳本時你會看到它。

如果那不是你問的那麼。

Sub ManuForwardAllSelectedItemsss_V1() 

Dim Item As Object 
Dim iSend As Long 

For iSend = 1 To ActiveExplorer.Selection.Count 

    If TypeOf Item Is mailItem Then 
     Set Item = ActiveExplorer.Selection(iSend) 
     AutoForwardAllSentItemsss Item 
    End If 

Next 

Set Item = Nothing 
MsgBox "Done" 

End Sub 

Sub ManuForwardAllSelectedItemsss_V2() 

Dim manuFwd As Outlook.mailItem 
Dim Item As mailItem 

Dim iSend As Long 

For iSend = 1 To ActiveExplorer.Selection.Count 

    Set Item = ActiveExplorer.Selection(iSend) 

    If TypeOf Item Is mailItem Then 
     Set manuFwd = Item.Forward 
     manuFwd.Recipients.Add "[email protected]" 
     manuFwd.Send 
    End If 
Next 

Set Item = Nothing 
Set manuFwd = Nothing 

End Sub