?
Solved

MS Outlook 2003 rule or script to move all outgoing email with me at BCC to a certain folder

Posted on 2011-04-26
5
Medium Priority
?
452 Views
Last Modified: 2012-06-22
Thanks,
JP
0
Comment
Question by:easycapital
  • 3
5 Comments
 
LVL 76

Accepted Solution

by:
David Lee earned 2000 total points
ID: 35466242
Hi, easycapital.

This should do it.  This script monitors items as they are sent and sets them to be saved in a certain folder if your email address is on the BCC line.  Follow these instructions to add the code to Outlook.

1.  Start Outlook
2.  Click Tools > Macro > Visual Basic Editor
3.  If not already expanded, expand Microsoft Office Outlook Objects and click on ThisOutlookSession
4.  Copy the code from the Code Snippet box and paste it into the right-hand pane of
5.  Outlook's VB Editor window
6.  Edit the code as needed.  I included comment lines wherever something needs to or can change
7.  Click the diskette icon on the toolbar to save the changes
8.  Close the VB Editor
9.  Click Tools > Macro > Security
10. Set the Security Level to Medium
11. Close Outlook
12. Start Outlook
13. Outlook will display a dialog-box warning that ThisOutlookSession contains macros and asking if you want to allow them to run.  Say yes.

In case you aren't familiar with folder paths in Outlook:

A folder path in Outlook is essentially the same as a folder path in the file system.  The one difference being that Outlook folder paths do not include a drive letter.  The path to a folder is a list of all the folders from the root to the target folder with each folder name separated from the preceding folder name by a backslash (i.e. \).  Consider the following folder structure:

Mailbox - Doe, John
    - Calendar
    - Inbox
    - Tasks
Personal Folders
    + Marketing
        + Proposals
        + Reviews
    + Projects
        + Project 1
        + Project 2

The path to "Inbox" is "Mailbox - Doe, John\Inbox".
The path to "Reviews" is "Personal Folders\Marketing\Reviews".
The path to "Project 1" is "Personal Folders\Projects\Project 1".
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    'On the next line edit the path to the folder you want to save the BCC items to'
    Const BCC_FOLDER_PATH = "Mailbox\Folder\Folder"
    Dim olkRcp As Outlook.Recipient
    If Item.Class = olMail Then
        For Each olkRcp In Item.Recipients
            If (olkRcp.Address = Session.CurrentUser.Address) And (olkRcp.Type = olBCC) Then
                Item.SaveSentMessageFolder = OpenOutlookFolder(BCC_FOLDER_PATH)
                Item.Save
                Exit For
            End If
        Next
    End If
End Sub

Function OpenOutlookFolder(strFolderPath As String) As Outlook.MAPIFolder
    ' Purpose: Opens an Outlook folder from a folder path.'
    ' Written: 4/24/2009'
    ' Author:  BlueDevilFan'
    ' Outlook: All versions'
    Dim arrFolders As Variant, _
        varFolder As Variant, _
        bolBeyondRoot As Boolean
    On Error Resume Next
    If strFolderPath = "" Then
        Set OpenOutlookFolder = Nothing
    Else
        Do While Left(strFolderPath, 1) = "\"
            strFolderPath = Right(strFolderPath, Len(strFolderPath) - 1)
        Loop
        arrFolders = Split(strFolderPath, "\")
        For Each varFolder In arrFolders
            Select Case bolBeyondRoot
                Case False
                    Set OpenOutlookFolder = Outlook.Session.Folders(varFolder)
                    bolBeyondRoot = True
                Case True
                    Set OpenOutlookFolder = OpenOutlookFolder.Folders(varFolder)
            End Select
            If Err.Number <> 0 Then
                Set OpenOutlookFolder = Nothing
                Exit For
            End If
        Next
    End If
    On Error GoTo 0
End Function

Open in new window

0
 
LVL 13

Expert Comment

by:Chris Raisin
ID: 35473362
Very nice, BlueDevilFan

Cheers
Chris
0
 
LVL 76

Expert Comment

by:David Lee
ID: 35473914
Thanks, Chris!
0
 

Author Closing Comment

by:easycapital
ID: 35747360
Real Nice!

Thanks,
JP
0
 
LVL 76

Expert Comment

by:David Lee
ID: 35748198
You're welcome, JP.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will help to fix the below errors for MS Exchange Server 2013 I. Certificate error "name on the security certificate is invalid or does not match the name of the site" II. Out of Office not working III. Make Internal URLs and Externa…
Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question