2014-07-01 3 views
0

J'ai un code VBA qui transmet automatiquement tous les emails à un compte externe. Je n'arrive pas à faire apparaître la macro dans le menu Macro lorsque je clique sur F5 pour l'exécuter.Macro n'apparaissant pas dans le menu Macro lorsque vous cliquez sur 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 

Répondre

0

Mettre en place une règle avec une course d'une option de script. Vous le verrez quand vous choisirez un script.

Si ce n'est pas ce que vous demandez alors.

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 

ou

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 
Questions connexes