PC Review


Reply
Thread Tools Rate Thread

Auto forward new email

 
 
New Member
Join Date: Jul 2011
Posts: 1
 
      7th Jul 2011
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!
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it possible to auto forward a sent email? =?Utf-8?B?Um9nZXJH?= Microsoft Outlook Discussion 1 10th Aug 2007 10:01 PM
auto forward email can not go to internet, or to internal email user Steve Microsoft Outlook 1 5th Jun 2007 12:35 PM
Auto forward email =?Utf-8?B?RGF2aWQ=?= Microsoft Outlook 1 6th Nov 2006 03:52 AM
Auto-forward email Fraz Microsoft Outlook 2 9th Jun 2004 10:15 AM
how to auto forward email? sandy Microsoft Outlook VBA Programming 1 12th Mar 2004 07:41 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:34 PM.