Auto forward new email


Joined
Jul 7, 2011
Messages
1
Reaction score
0
Hello,
I copy-pasted a macro to automatically forward new email to an external address (rules are blocked), obviously it runs only when outlook is running:

Public WithEvents myOlItems As Outlook.Items

Public Sub Application_Startup()
' Reference the items in the Inbox. Because myOlItems is declared
' "WithEvents" the ItemAdd event will fire below.
Set myOlItems = Outlook.Session.GetDefaultFolder(olFolderInbox).Items
End Sub

Private Sub myOlItems_ItemAdd(ByVal Item As Object)

' Check to make sure it is an Outlook mail message, otherwise
' subsequent code will probably fail depending on what type
' of item it is.
If TypeName(Item) = "MailItem" Then

' Forward the item just received
Set myForward = Item.Forward

' Address the message
myForward.Recipients.Add "(email address)"

' Send it
myForward.Send

End If
End Sub
However it doesn't forward new email that was received before launching outlook. ie if I launch outlook at 8am, email that was received at 7am appears in my inbox but is not forwarded, only messages that are received after 8am are forwarded.
Is there any way to program a macro to check for (and forward) messages that were received prior to outlook launch?
Thanks!
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top