PC Review


Reply
Thread Tools Rate Thread

Auto Forward Emails - Specific Time Periods Only

 
 
J_Nettles
Guest
Posts: n/a
 
      18th Jan 2010
Afternoon All:

I'm not sure if this can be done or not... we want to auto forward by rule
email messages during a specific time period... most specifically after
hours... is it possible to create a rule that would forward emails with a
specific criteria during a specific set of hours?

Thanks
--
J_Nettles
 
Reply With Quote
 
 
 
 
Josh Skelton
Guest
Posts: n/a
 
      8th Mar 2011
Below is a VBA script, a macro, that will forward emails received in your Outlook Inbox to an external email address. I needed this to forward work emails from Outlook to my Blackberry phone and it works.

To use it:
1. Start Outlook
2. Click Tools->Macro->Visual Basic Editor
3. If not already expanded, expand Microsoft Outlook Objects in the Project pane, then click on "ThisOutlookSession"
4. Copy the script below
5. Paste the script into the right-hand pane of the VB Editor
6. Edit the script making the changes as per the comments I included in the code
7. Click the diskette icon on the toolbar to save the changes
8. Close the VB Editor
9. Click Tools->Macro->Security
10. Set Security Level to Medium
11. Close Outlook
12. Start Outlook
13. A dialog-box will appear telling you the ThisOutlookSession contains macros and asking if you want to enable them. Say yes.
14. Test the macro
15. When the macro runs Outlook will present you with another dialog-box advising that a program is trying to access your mailbox and asking if you want to allow it to. Say yes.
16. If a message is received in the mailbox, and if the time is currently between the times you set, then the message will be forwarded to the designated email address. Otherwise, nothing will happen.
17. Once you've verified that the macro works as expected, then you need to sign the macro to avoid having Outlook security warn you each time the macro runs.

'START CODE
Private WithEvents objInboxItems As Items

Private Sub Application_Startup()
Dim objNS As NameSpace
Set objNS = Application.GetNamespace("MAPI")
' instantiate Items collections for folders we want to monitor
Set objInboxItems = objNS.GetDefaultFolder(olFolderInbox).Items
Set objNS = Nothing
End Sub

Private Sub Application_Quit()
' disassociate global objects declared WithEvents
Set objInboxItems = Nothing
End Sub

Private Sub objInboxItems_ItemAdd(ByVal Item As Object)
Dim olItems As Items, _
olItem As Object, _
olMailItem As MailItem, _
olAttachmentItem As Attachment, _
bolTimeMatch As Boolean
Set olItems = objInboxItems.Restrict("[Unread] = True")
For Each olItem In olItems
If olItem.Class = olMail Then
Set olMailItem = olItem
'Change the times on the next line to those you want to use
bolTimeMatch = (Time >= #4:00:00 PM#) And (Time <= #8:30:00 AM#)
If bolTimeMatch Then
Dim objMail As Outlook.MailItem
Set objItem = olMailItem
Set objMail = objItem.Forward
'PUT THE EXTERNAL EMAIL ADDRESS YOU WANT TO USE ON THE NEXT LINE
objMail.To = "(E-Mail Removed)"
objMail.Send
Set objItem = Nothing
Set objMail = Nothing
End If
End If
Next
End Sub

Function IsNothing(Obj)
If TypeName(Obj) = "Nothing" Then
IsNothing = True
Else
IsNothing = False
End If
End Function
'END CODE

> On Monday, January 18, 2010 1:06 PM J_Nettles wrote:


> Afternoon All:
>
> I am not sure if this can be done or not... we want to auto forward by rule
> email messages during a specific time period... most specifically after
> hours... is it possible to create a rule that would forward emails with a
> specific criteria during a specific set of hours?
>
> Thanks
> --
> J_Nettles



> Submitted via EggHeadCafe
> SQL Server CLR Stored Procedures for External Access
> http://www.eggheadcafe.com/tutorials...al-access.aspx

 
Reply With Quote
 
Josh Skelton
Guest
Posts: n/a
 
      8th Mar 2011
Below is a VBA script, a macro, that will forward emails received in your Outlook Inbox to an external email address. I needed this to forward work emails from Outlook to my Blackberry phone and it works.

To use it:
1. Start Outlook
2. Click Tools->Macro->Visual Basic Editor
3. If not already expanded, expand Microsoft Outlook Objects in the Project pane, then click on "ThisOutlookSession"
4. Copy the script below
5. Paste the script into the right-hand pane of the VB Editor
6. Edit the script making the changes as per the comments I included in the code
7. Click the diskette icon on the toolbar to save the changes
8. Close the VB Editor
9. Click Tools->Macro->Security
10. Set Security Level to Medium
11. Close Outlook
12. Start Outlook
13. A dialog-box will appear telling you the ThisOutlookSession contains macros and asking if you want to enable them. Say yes.
14. Test the macro
15. When the macro runs Outlook will present you with another dialog-box advising that a program is trying to access your mailbox and asking if you want to allow it to. Say yes.
16. If a message is received in the mailbox, and if the time is currently between the times you set, then the message will be forwarded to the designated email address. Otherwise, nothing will happen.
17. Once you've verified that the macro works as expected, then you need to sign the macro to avoid having Outlook security warn you each time the macro runs.

'START CODE
Private WithEvents objInboxItems As Items

Private Sub Application_Startup()
Dim objNS As NameSpace
Set objNS = Application.GetNamespace("MAPI")
' instantiate Items collections for folders we want to monitor
Set objInboxItems = objNS.GetDefaultFolder(olFolderInbox).Items
Set objNS = Nothing
End Sub

Private Sub Application_Quit()
' disassociate global objects declared WithEvents
Set objInboxItems = Nothing
End Sub

Private Sub objInboxItems_ItemAdd(ByVal Item As Object)
Dim olItems As Items, _
olItem As Object, _
olMailItem As MailItem, _
olAttachmentItem As Attachment, _
bolTimeMatch As Boolean
Set olItems = objInboxItems.Restrict("[Unread] = True")
For Each olItem In olItems
If olItem.Class = olMail Then
Set olMailItem = olItem
'Change the times on the next line to those you want to use
bolTimeMatch = (Time >= #4:00:00 PM#) And (Time <= #8:30:00 AM#)
If bolTimeMatch Then
Dim objMail As Outlook.MailItem
Set objItem = olMailItem
Set objMail = objItem.Forward
'PUT THE EXTERNAL EMAIL ADDRESS YOU WANT TO USE ON THE NEXT LINE
objMail.To = "(E-Mail Removed)"
objMail.Send
Set objItem = Nothing
Set objMail = Nothing
End If
End If
Next
End Sub

Function IsNothing(Obj)
If TypeName(Obj) = "Nothing" Then
IsNothing = True
Else
IsNothing = False
End If
End Function
'END CODE

> On Monday, January 18, 2010 1:06 PM J_Nettles wrote:


> Afternoon All:
>
> I am not sure if this can be done or not... we want to auto forward by rule
> email messages during a specific time period... most specifically after
> hours... is it possible to create a rule that would forward emails with a
> specific criteria during a specific set of hours?
>
> Thanks
> --
> J_Nettles



>> On Tuesday, March 08, 2011 4:19 PM Josh Skelton wrote:


>> Below is a VBA script, a macro, that will forward emails received in your Outlook Inbox to an external email address. I needed this to forward work emails from Outlook to my Blackberry phone and it works.
>>
>>
>>
>> To use it:
>>
>> 1. Start Outlook
>>
>> 2. Click Tools->Macro->Visual Basic Editor
>>
>> 3. If not already expanded, expand Microsoft Outlook Objects in the Project pane, then click on "ThisOutlookSession"
>>
>> 4. Copy the script below
>>
>> 5. Paste the script into the right-hand pane of the VB Editor
>>
>> 6. Edit the script making the changes as per the comments I included in the code
>>
>> 7. Click the diskette icon on the toolbar to save the changes
>>
>> 8. Close the VB Editor
>>
>> 9. Click Tools->Macro->Security
>>
>> 10. Set Security Level to Medium
>>
>> 11. Close Outlook
>>
>> 12. Start Outlook
>>
>> 13. A dialog-box will appear telling you the ThisOutlookSession contains macros and asking if you want to enable them. Say yes.
>>
>> 14. Test the macro
>>
>> 15. When the macro runs Outlook will present you with another dialog-box advising that a program is trying to access your mailbox and asking if you want to allow it to. Say yes.
>>
>> 16. If a message is received in the mailbox, and if the time is currently between the times you set, then the message will be forwarded to the designated email address. Otherwise, nothing will happen.
>>
>> 17. Once you've verified that the macro works as expected, then you need to sign the macro to avoid having Outlook security warn you each time the macro runs.
>>
>>
>>
>> 'START CODE
>>
>> Private WithEvents objInboxItems As Items
>>
>>
>>
>> Private Sub Application_Startup()
>>
>> Dim objNS As NameSpace
>>
>> Set objNS = Application.GetNamespace("MAPI")
>>
>> ' instantiate Items collections for folders we want to monitor
>>
>> Set objInboxItems = objNS.GetDefaultFolder(olFolderInbox).Items
>>
>> Set objNS = Nothing
>>
>> End Sub
>>
>>
>>
>> Private Sub Application_Quit()
>>
>> ' disassociate global objects declared WithEvents
>>
>> Set objInboxItems = Nothing
>>
>> End Sub
>>
>>
>>
>> Private Sub objInboxItems_ItemAdd(ByVal Item As Object)
>>
>> Dim olItems As Items, _
>>
>> olItem As Object, _
>>
>> olMailItem As MailItem, _
>>
>> olAttachmentItem As Attachment, _
>>
>> bolTimeMatch As Boolean
>>
>> Set olItems = objInboxItems.Restrict("[Unread] = True")
>>
>> For Each olItem In olItems
>>
>> If olItem.Class = olMail Then
>>
>> Set olMailItem = olItem
>>
>> 'Change the times on the next line to those you want to use
>>
>> bolTimeMatch = (Time >= #4:00:00 PM#) And (Time <= #8:30:00 AM#)
>>
>> If bolTimeMatch Then
>>
>> Dim objMail As Outlook.MailItem
>>
>> Set objItem = olMailItem
>>
>> Set objMail = objItem.Forward
>>
>> 'PUT THE EXTERNAL EMAIL ADDRESS YOU WANT TO USE ON THE NEXT LINE
>>
>> objMail.To = "(E-Mail Removed)"
>>
>> objMail.Send
>>
>> Set objItem = Nothing
>>
>> Set objMail = Nothing
>>
>> End If
>>
>> End If
>>
>> Next
>>
>> End Sub
>>
>>
>>
>> Function IsNothing(Obj)
>>
>> If TypeName(Obj) = "Nothing" Then
>>
>> IsNothing = True
>>
>> Else
>>
>> IsNothing = False
>>
>> End If
>>
>> End Function
>>
>> 'END CODE



>> Submitted via EggHeadCafe
>> LINQ executed in Parallel (PLINQ)
>> http://www.eggheadcafe.com/tutorials...lel-plinq.aspx

 
Reply With Quote
 
Josh Skelton
Guest
Posts: n/a
 
      8th Mar 2011
Below is a VBA script, a macro, that will forward emails received in your Outlook Inbox to an external email address. I needed this to forward work emails from Outlook to my Blackberry phone and it works.

To use it:
1. Start Outlook
2. Click Tools->Macro->Visual Basic Editor
3. If not already expanded, expand Microsoft Outlook Objects in the Project pane, then click on "ThisOutlookSession"
4. Copy the script below
5. Paste the script into the right-hand pane of the VB Editor
6. Edit the script making the changes as per the comments I included in the code
7. Click the diskette icon on the toolbar to save the changes
8. Close the VB Editor
9. Click Tools->Macro->Security
10. Set Security Level to Medium
11. Close Outlook
12. Start Outlook
13. A dialog-box will appear telling you the ThisOutlookSession contains macros and asking if you want to enable them. Say yes.
14. Test the macro
15. When the macro runs Outlook will present you with another dialog-box advising that a program is trying to access your mailbox and asking if you want to allow it to. Say yes.
16. If a message is received in the mailbox, and if the time is currently between the times you set, then the message will be forwarded to the designated email address. Otherwise, nothing will happen.
17. Once you've verified that the macro works as expected, then you need to sign the macro to avoid having Outlook security warn you each time the macro runs.

'START CODE
Private WithEvents objInboxItems As Items

Private Sub Application_Startup()
Dim objNS As NameSpace
Set objNS = Application.GetNamespace("MAPI")
' instantiate Items collections for folders we want to monitor
Set objInboxItems = objNS.GetDefaultFolder(olFolderInbox).Items
Set objNS = Nothing
End Sub

Private Sub Application_Quit()
' disassociate global objects declared WithEvents
Set objInboxItems = Nothing
End Sub

Private Sub objInboxItems_ItemAdd(ByVal Item As Object)
Dim olItems As Items, _
olItem As Object, _
olMailItem As MailItem, _
olAttachmentItem As Attachment, _
bolTimeMatch As Boolean
Set olItems = objInboxItems.Restrict("[Unread] = True")
For Each olItem In olItems
If olItem.Class = olMail Then
Set olMailItem = olItem
'Change the times on the next line to those you want to use
bolTimeMatch = (Time >= #4:00:00 PM#) And (Time <= #8:30:00 AM#)
If bolTimeMatch Then
Dim objMail As Outlook.MailItem
Set objItem = olMailItem
Set objMail = objItem.Forward
'PUT THE EXTERNAL EMAIL ADDRESS YOU WANT TO USE ON THE NEXT LINE
objMail.To = "(E-Mail Removed)"
objMail.Send
Set objItem = Nothing
Set objMail = Nothing
End If
End If
Next
End Sub

Function IsNothing(Obj)
If TypeName(Obj) = "Nothing" Then
IsNothing = True
Else
IsNothing = False
End If
End Function
'END CODE

> On Monday, January 18, 2010 1:06 PM J_Nettles wrote:


> Afternoon All:
>
> I am not sure if this can be done or not... we want to auto forward by rule
> email messages during a specific time period... most specifically after
> hours... is it possible to create a rule that would forward emails with a
> specific criteria during a specific set of hours?
>
> Thanks
> --
> J_Nettles



>> On Tuesday, March 08, 2011 4:19 PM Josh Skelton wrote:


>> Below is a VBA script, a macro, that will forward emails received in your Outlook Inbox to an external email address. I needed this to forward work emails from Outlook to my Blackberry phone and it works.
>>
>>
>>
>> To use it:
>>
>> 1. Start Outlook
>>
>> 2. Click Tools->Macro->Visual Basic Editor
>>
>> 3. If not already expanded, expand Microsoft Outlook Objects in the Project pane, then click on "ThisOutlookSession"
>>
>> 4. Copy the script below
>>
>> 5. Paste the script into the right-hand pane of the VB Editor
>>
>> 6. Edit the script making the changes as per the comments I included in the code
>>
>> 7. Click the diskette icon on the toolbar to save the changes
>>
>> 8. Close the VB Editor
>>
>> 9. Click Tools->Macro->Security
>>
>> 10. Set Security Level to Medium
>>
>> 11. Close Outlook
>>
>> 12. Start Outlook
>>
>> 13. A dialog-box will appear telling you the ThisOutlookSession contains macros and asking if you want to enable them. Say yes.
>>
>> 14. Test the macro
>>
>> 15. When the macro runs Outlook will present you with another dialog-box advising that a program is trying to access your mailbox and asking if you want to allow it to. Say yes.
>>
>> 16. If a message is received in the mailbox, and if the time is currently between the times you set, then the message will be forwarded to the designated email address. Otherwise, nothing will happen.
>>
>> 17. Once you've verified that the macro works as expected, then you need to sign the macro to avoid having Outlook security warn you each time the macro runs.
>>
>>
>>
>> 'START CODE
>>
>> Private WithEvents objInboxItems As Items
>>
>>
>>
>> Private Sub Application_Startup()
>>
>> Dim objNS As NameSpace
>>
>> Set objNS = Application.GetNamespace("MAPI")
>>
>> ' instantiate Items collections for folders we want to monitor
>>
>> Set objInboxItems = objNS.GetDefaultFolder(olFolderInbox).Items
>>
>> Set objNS = Nothing
>>
>> End Sub
>>
>>
>>
>> Private Sub Application_Quit()
>>
>> ' disassociate global objects declared WithEvents
>>
>> Set objInboxItems = Nothing
>>
>> End Sub
>>
>>
>>
>> Private Sub objInboxItems_ItemAdd(ByVal Item As Object)
>>
>> Dim olItems As Items, _
>>
>> olItem As Object, _
>>
>> olMailItem As MailItem, _
>>
>> olAttachmentItem As Attachment, _
>>
>> bolTimeMatch As Boolean
>>
>> Set olItems = objInboxItems.Restrict("[Unread] = True")
>>
>> For Each olItem In olItems
>>
>> If olItem.Class = olMail Then
>>
>> Set olMailItem = olItem
>>
>> 'Change the times on the next line to those you want to use
>>
>> bolTimeMatch = (Time >= #4:00:00 PM#) And (Time <= #8:30:00 AM#)
>>
>> If bolTimeMatch Then
>>
>> Dim objMail As Outlook.MailItem
>>
>> Set objItem = olMailItem
>>
>> Set objMail = objItem.Forward
>>
>> 'PUT THE EXTERNAL EMAIL ADDRESS YOU WANT TO USE ON THE NEXT LINE
>>
>> objMail.To = "(E-Mail Removed)"
>>
>> objMail.Send
>>
>> Set objItem = Nothing
>>
>> Set objMail = Nothing
>>
>> End If
>>
>> End If
>>
>> Next
>>
>> End Sub
>>
>>
>>
>> Function IsNothing(Obj)
>>
>> If TypeName(Obj) = "Nothing" Then
>>
>> IsNothing = True
>>
>> Else
>>
>> IsNothing = False
>>
>> End If
>>
>> End Function
>>
>> 'END CODE



>>> On Tuesday, March 08, 2011 4:20 PM Josh Skelton wrote:


>>> Below is a VBA script, a macro, that will forward emails received in your Outlook Inbox to an external email address. I needed this to forward work emails from Outlook to my Blackberry phone and it works.
>>>
>>>
>>>
>>> To use it:
>>>
>>> 1. Start Outlook
>>>
>>> 2. Click Tools->Macro->Visual Basic Editor
>>>
>>> 3. If not already expanded, expand Microsoft Outlook Objects in the Project pane, then click on "ThisOutlookSession"
>>>
>>> 4. Copy the script below
>>>
>>> 5. Paste the script into the right-hand pane of the VB Editor
>>>
>>> 6. Edit the script making the changes as per the comments I included in the code
>>>
>>> 7. Click the diskette icon on the toolbar to save the changes
>>>
>>> 8. Close the VB Editor
>>>
>>> 9. Click Tools->Macro->Security
>>>
>>> 10. Set Security Level to Medium
>>>
>>> 11. Close Outlook
>>>
>>> 12. Start Outlook
>>>
>>> 13. A dialog-box will appear telling you the ThisOutlookSession contains macros and asking if you want to enable them. Say yes.
>>>
>>> 14. Test the macro
>>>
>>> 15. When the macro runs Outlook will present you with another dialog-box advising that a program is trying to access your mailbox and asking if you want to allow it to. Say yes.
>>>
>>> 16. If a message is received in the mailbox, and if the time is currently between the times you set, then the message will be forwarded to the designated email address. Otherwise, nothing will happen.
>>>
>>> 17. Once you've verified that the macro works as expected, then you need to sign the macro to avoid having Outlook security warn you each time the macro runs.
>>>
>>>
>>>
>>> 'START CODE
>>>
>>> Private WithEvents objInboxItems As Items
>>>
>>>
>>>
>>> Private Sub Application_Startup()
>>>
>>> Dim objNS As NameSpace
>>>
>>> Set objNS = Application.GetNamespace("MAPI")
>>>
>>> ' instantiate Items collections for folders we want to monitor
>>>
>>> Set objInboxItems = objNS.GetDefaultFolder(olFolderInbox).Items
>>>
>>> Set objNS = Nothing
>>>
>>> End Sub
>>>
>>>
>>>
>>> Private Sub Application_Quit()
>>>
>>> ' disassociate global objects declared WithEvents
>>>
>>> Set objInboxItems = Nothing
>>>
>>> End Sub
>>>
>>>
>>>
>>> Private Sub objInboxItems_ItemAdd(ByVal Item As Object)
>>>
>>> Dim olItems As Items, _
>>>
>>> olItem As Object, _
>>>
>>> olMailItem As MailItem, _
>>>
>>> olAttachmentItem As Attachment, _
>>>
>>> bolTimeMatch As Boolean
>>>
>>> Set olItems = objInboxItems.Restrict("[Unread] = True")
>>>
>>> For Each olItem In olItems
>>>
>>> If olItem.Class = olMail Then
>>>
>>> Set olMailItem = olItem
>>>
>>> 'Change the times on the next line to those you want to use
>>>
>>> bolTimeMatch = (Time >= #4:00:00 PM#) And (Time <= #8:30:00 AM#)
>>>
>>> If bolTimeMatch Then
>>>
>>> Dim objMail As Outlook.MailItem
>>>
>>> Set objItem = olMailItem
>>>
>>> Set objMail = objItem.Forward
>>>
>>> 'PUT THE EXTERNAL EMAIL ADDRESS YOU WANT TO USE ON THE NEXT LINE
>>>
>>> objMail.To = "(E-Mail Removed)"
>>>
>>> objMail.Send
>>>
>>> Set objItem = Nothing
>>>
>>> Set objMail = Nothing
>>>
>>> End If
>>>
>>> End If
>>>
>>> Next
>>>
>>> End Sub
>>>
>>>
>>>
>>> Function IsNothing(Obj)
>>>
>>> If TypeName(Obj) = "Nothing" Then
>>>
>>> IsNothing = True
>>>
>>> Else
>>>
>>> IsNothing = False
>>>
>>> End If
>>>
>>> End Function
>>>
>>> 'END CODE



>>> Submitted via EggHeadCafe
>>> ASP.NET JSON Cookies and Excel
>>> http://www.eggheadcafe.com/tutorials...and-excel.aspx

 
Reply With Quote
 
Goobus
Guest
Posts: n/a
 
      8th Mar 2011
Do you even bother to check the dates of the posts you are replying to?
Typical HoopleHead EggHead.

On 3/8/2011 3:21 PM, Josh Skelton wrote:
> Below is a VBA script, a macro, that will forward emails received in your Outlook Inbox to an external email address. I needed this to forward work emails from Outlook to my Blackberry phone and it works.
>
> To use it:
> 1. Start Outlook
> 2. Click Tools->Macro->Visual Basic Editor
> 3. If not already expanded, expand Microsoft Outlook Objects in the Project pane, then click on "ThisOutlookSession"
> 4. Copy the script below
> 5. Paste the script into the right-hand pane of the VB Editor
> 6. Edit the script making the changes as per the comments I included in the code
> 7. Click the diskette icon on the toolbar to save the changes
> 8. Close the VB Editor
> 9. Click Tools->Macro->Security
> 10. Set Security Level to Medium
> 11. Close Outlook
> 12. Start Outlook
> 13. A dialog-box will appear telling you the ThisOutlookSession contains macros and asking if you want to enable them. Say yes.
> 14. Test the macro
> 15. When the macro runs Outlook will present you with another dialog-box advising that a program is trying to access your mailbox and asking if you want to allow it to. Say yes.
> 16. If a message is received in the mailbox, and if the time is currently between the times you set, then the message will be forwarded to the designated email address. Otherwise, nothing will happen.
> 17. Once you've verified that the macro works as expected, then you need to sign the macro to avoid having Outlook security warn you each time the macro runs.
>
> 'START CODE
> Private WithEvents objInboxItems As Items
>
> Private Sub Application_Startup()
> Dim objNS As NameSpace
> Set objNS = Application.GetNamespace("MAPI")
> ' instantiate Items collections for folders we want to monitor
> Set objInboxItems = objNS.GetDefaultFolder(olFolderInbox).Items
> Set objNS = Nothing
> End Sub
>
> Private Sub Application_Quit()
> ' disassociate global objects declared WithEvents
> Set objInboxItems = Nothing
> End Sub
>
> Private Sub objInboxItems_ItemAdd(ByVal Item As Object)
> Dim olItems As Items, _
> olItem As Object, _
> olMailItem As MailItem, _
> olAttachmentItem As Attachment, _
> bolTimeMatch As Boolean
> Set olItems = objInboxItems.Restrict("[Unread] = True")
> For Each olItem In olItems
> If olItem.Class = olMail Then
> Set olMailItem = olItem
> 'Change the times on the next line to those you want to use
> bolTimeMatch = (Time>= #4:00:00 PM#) And (Time<= #8:30:00 AM#)
> If bolTimeMatch Then
> Dim objMail As Outlook.MailItem
> Set objItem = olMailItem
> Set objMail = objItem.Forward
> 'PUT THE EXTERNAL EMAIL ADDRESS YOU WANT TO USE ON THE NEXT LINE
> objMail.To = "(E-Mail Removed)"
> objMail.Send
> Set objItem = Nothing
> Set objMail = Nothing
> End If
> End If
> Next
> End Sub
>
> Function IsNothing(Obj)
> If TypeName(Obj) = "Nothing" Then
> IsNothing = True
> Else
> IsNothing = False
> End If
> End Function
> 'END CODE
>
>> On Monday, January 18, 2010 1:06 PM J_Nettles wrote:

>
>> Afternoon All:
>>
>> I am not sure if this can be done or not... we want to auto forward by rule
>> email messages during a specific time period... most specifically after
>> hours... is it possible to create a rule that would forward emails with a
>> specific criteria during a specific set of hours?
>>
>> Thanks
>> --
>> J_Nettles

>
>
>>> On Tuesday, March 08, 2011 4:19 PM Josh Skelton wrote:

>
>>> Below is a VBA script, a macro, that will forward emails received in your Outlook Inbox to an external email address. I needed this to forward work emails from Outlook to my Blackberry phone and it works.
>>>
>>>
>>>
>>> To use it:
>>>
>>> 1. Start Outlook
>>>
>>> 2. Click Tools->Macro->Visual Basic Editor
>>>
>>> 3. If not already expanded, expand Microsoft Outlook Objects in the Project pane, then click on "ThisOutlookSession"
>>>
>>> 4. Copy the script below
>>>
>>> 5. Paste the script into the right-hand pane of the VB Editor
>>>
>>> 6. Edit the script making the changes as per the comments I included in the code
>>>
>>> 7. Click the diskette icon on the toolbar to save the changes
>>>
>>> 8. Close the VB Editor
>>>
>>> 9. Click Tools->Macro->Security
>>>
>>> 10. Set Security Level to Medium
>>>
>>> 11. Close Outlook
>>>
>>> 12. Start Outlook
>>>
>>> 13. A dialog-box will appear telling you the ThisOutlookSession contains macros and asking if you want to enable them. Say yes.
>>>
>>> 14. Test the macro
>>>
>>> 15. When the macro runs Outlook will present you with another dialog-box advising that a program is trying to access your mailbox and asking if you want to allow it to. Say yes.
>>>
>>> 16. If a message is received in the mailbox, and if the time is currently between the times you set, then the message will be forwarded to the designated email address. Otherwise, nothing will happen.
>>>
>>> 17. Once you've verified that the macro works as expected, then you need to sign the macro to avoid having Outlook security warn you each time the macro runs.
>>>
>>>
>>>
>>> 'START CODE
>>>
>>> Private WithEvents objInboxItems As Items
>>>
>>>
>>>
>>> Private Sub Application_Startup()
>>>
>>> Dim objNS As NameSpace
>>>
>>> Set objNS = Application.GetNamespace("MAPI")
>>>
>>> ' instantiate Items collections for folders we want to monitor
>>>
>>> Set objInboxItems = objNS.GetDefaultFolder(olFolderInbox).Items
>>>
>>> Set objNS = Nothing
>>>
>>> End Sub
>>>
>>>
>>>
>>> Private Sub Application_Quit()
>>>
>>> ' disassociate global objects declared WithEvents
>>>
>>> Set objInboxItems = Nothing
>>>
>>> End Sub
>>>
>>>
>>>
>>> Private Sub objInboxItems_ItemAdd(ByVal Item As Object)
>>>
>>> Dim olItems As Items, _
>>>
>>> olItem As Object, _
>>>
>>> olMailItem As MailItem, _
>>>
>>> olAttachmentItem As Attachment, _
>>>
>>> bolTimeMatch As Boolean
>>>
>>> Set olItems = objInboxItems.Restrict("[Unread] = True")
>>>
>>> For Each olItem In olItems
>>>
>>> If olItem.Class = olMail Then
>>>
>>> Set olMailItem = olItem
>>>
>>> 'Change the times on the next line to those you want to use
>>>
>>> bolTimeMatch = (Time>= #4:00:00 PM#) And (Time<= #8:30:00 AM#)
>>>
>>> If bolTimeMatch Then
>>>
>>> Dim objMail As Outlook.MailItem
>>>
>>> Set objItem = olMailItem
>>>
>>> Set objMail = objItem.Forward
>>>
>>> 'PUT THE EXTERNAL EMAIL ADDRESS YOU WANT TO USE ON THE NEXT LINE
>>>
>>> objMail.To = "(E-Mail Removed)"
>>>
>>> objMail.Send
>>>
>>> Set objItem = Nothing
>>>
>>> Set objMail = Nothing
>>>
>>> End If
>>>
>>> End If
>>>
>>> Next
>>>
>>> End Sub
>>>
>>>
>>>
>>> Function IsNothing(Obj)
>>>
>>> If TypeName(Obj) = "Nothing" Then
>>>
>>> IsNothing = True
>>>
>>> Else
>>>
>>> IsNothing = False
>>>
>>> End If
>>>
>>> End Function
>>>
>>> 'END CODE

>
>
>>>> On Tuesday, March 08, 2011 4:20 PM Josh Skelton wrote:

>
>>>> Below is a VBA script, a macro, that will forward emails received in your Outlook Inbox to an external email address. I needed this to forward work emails from Outlook to my Blackberry phone and it works.
>>>>
>>>>
>>>>
>>>> To use it:
>>>>
>>>> 1. Start Outlook
>>>>
>>>> 2. Click Tools->Macro->Visual Basic Editor
>>>>
>>>> 3. If not already expanded, expand Microsoft Outlook Objects in the Project pane, then click on "ThisOutlookSession"
>>>>
>>>> 4. Copy the script below
>>>>
>>>> 5. Paste the script into the right-hand pane of the VB Editor
>>>>
>>>> 6. Edit the script making the changes as per the comments I included in the code
>>>>
>>>> 7. Click the diskette icon on the toolbar to save the changes
>>>>
>>>> 8. Close the VB Editor
>>>>
>>>> 9. Click Tools->Macro->Security
>>>>
>>>> 10. Set Security Level to Medium
>>>>
>>>> 11. Close Outlook
>>>>
>>>> 12. Start Outlook
>>>>
>>>> 13. A dialog-box will appear telling you the ThisOutlookSession contains macros and asking if you want to enable them. Say yes.
>>>>
>>>> 14. Test the macro
>>>>
>>>> 15. When the macro runs Outlook will present you with another dialog-box advising that a program is trying to access your mailbox and asking if you want to allow it to. Say yes.
>>>>
>>>> 16. If a message is received in the mailbox, and if the time is currently between the times you set, then the message will be forwarded to the designated email address. Otherwise, nothing will happen.
>>>>
>>>> 17. Once you've verified that the macro works as expected, then you need to sign the macro to avoid having Outlook security warn you each time the macro runs.
>>>>
>>>>
>>>>
>>>> 'START CODE
>>>>
>>>> Private WithEvents objInboxItems As Items
>>>>
>>>>
>>>>
>>>> Private Sub Application_Startup()
>>>>
>>>> Dim objNS As NameSpace
>>>>
>>>> Set objNS = Application.GetNamespace("MAPI")
>>>>
>>>> ' instantiate Items collections for folders we want to monitor
>>>>
>>>> Set objInboxItems = objNS.GetDefaultFolder(olFolderInbox).Items
>>>>
>>>> Set objNS = Nothing
>>>>
>>>> End Sub
>>>>
>>>>
>>>>
>>>> Private Sub Application_Quit()
>>>>
>>>> ' disassociate global objects declared WithEvents
>>>>
>>>> Set objInboxItems = Nothing
>>>>
>>>> End Sub
>>>>
>>>>
>>>>
>>>> Private Sub objInboxItems_ItemAdd(ByVal Item As Object)
>>>>
>>>> Dim olItems As Items, _
>>>>
>>>> olItem As Object, _
>>>>
>>>> olMailItem As MailItem, _
>>>>
>>>> olAttachmentItem As Attachment, _
>>>>
>>>> bolTimeMatch As Boolean
>>>>
>>>> Set olItems = objInboxItems.Restrict("[Unread] = True")
>>>>
>>>> For Each olItem In olItems
>>>>
>>>> If olItem.Class = olMail Then
>>>>
>>>> Set olMailItem = olItem
>>>>
>>>> 'Change the times on the next line to those you want to use
>>>>
>>>> bolTimeMatch = (Time>= #4:00:00 PM#) And (Time<= #8:30:00 AM#)
>>>>
>>>> If bolTimeMatch Then
>>>>
>>>> Dim objMail As Outlook.MailItem
>>>>
>>>> Set objItem = olMailItem
>>>>
>>>> Set objMail = objItem.Forward
>>>>
>>>> 'PUT THE EXTERNAL EMAIL ADDRESS YOU WANT TO USE ON THE NEXT LINE
>>>>
>>>> objMail.To = "(E-Mail Removed)"
>>>>
>>>> objMail.Send
>>>>
>>>> Set objItem = Nothing
>>>>
>>>> Set objMail = Nothing
>>>>
>>>> End If
>>>>
>>>> End If
>>>>
>>>> Next
>>>>
>>>> End Sub
>>>>
>>>>
>>>>
>>>> Function IsNothing(Obj)
>>>>
>>>> If TypeName(Obj) = "Nothing" Then
>>>>
>>>> IsNothing = True
>>>>
>>>> Else
>>>>
>>>> IsNothing = False
>>>>
>>>> End If
>>>>
>>>> End Function
>>>>
>>>> 'END CODE

>
>
>>>> Submitted via EggHeadCafe
>>>> ASP.NET JSON Cookies and Excel
>>>> http://www.eggheadcafe.com/tutorials...and-excel.aspx


 
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
auto forward of sent box emails at10 Windows Vista Mail 1 18th Sep 2009 07:03 AM
How do I auto-forward specific incoming emails to another email? MAPSRUS_071207 Microsoft Outlook Discussion 6 28th May 2009 07:23 PM
Dont receive any emails at different periods of time PM1967 Microsoft Outlook Discussion 0 27th Nov 2008 10:28 PM
How to run a rule only during specific time periods? Alan Microsoft Outlook 2 26th Sep 2006 07:26 PM
auto forward specific emails =?Utf-8?B?QW50aG9ueQ==?= Microsoft Outlook Discussion 1 15th Dec 2004 04:08 PM


Features
 

Advertising
 

Newsgroups
 


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