I know this must be reasonably simple, I'm new to outlook VBA and obviously not understanding the syntax, so I'm not find results elsewhere.
Outlook exchange is disabled for forwarding to an external address, the rule I had got switched off hence going the VBA route
I want to forward any message that is sent to ACCIDENT (either TO or COPY or BCC) and I can't find the words to write that
I have the below code which will forward everything and it works, just want to limit it a lot
please can someone point or correct for thisPrivate Sub Application_NewMailEx(ByVal EntryIDCollection As String) Dim varEntryIDs Dim objItem Dim i As Integer Dim bSend As Boolean Dim fwdItem As Outlook.MailItem On Error Resume Next bSend = False If Hour(Now) > 15 Or Hour(Now) < 7 Then 'After hours bSend = True ' ElseIf Hour(Now) = 12 Then 'Lunch ' bSend = True ' ElseIf checkBusy Then 'In meeting ' bSend = True End If bSend = True ' non rule test If bSend Then varEntryIDs = Split(EntryIDCollection, ",") For i = 0 To UBound(varEntryIDs) Set objItem = Application.Session.GetItemFromID(varEntryIDs(i)) Set fwdItem = objItem.Forward fwdItem.Recipients.Add "[EMAIL fwdItem.SentOnBehalfOfName = Item.SentOnBehalfOfName fwdItem.Send Next End If End Sub