Mark copy of sent email as read - VBA?

Status
Not open for further replies.
B

BlueWolverine

Hello,

MS OUTLOOK 2003 on XP PRO.

I would like to setup a "rule" (either a "Rules Wizard" Rule or code in VBA)

to make a copy of every sent email, move it to a folder and mark that copy as

read. I did a search on google, and found the command "Item.Unread=false"

but I have no idea how to setup the code around it.

I hate asking, "Can someone show me how to do the entirety of what I'm

asking?" but I've never programmed in Outlook before and I have no idea how

to define an event trigger. (In access, I'd be looking for something like

"OnEmailSent") I have reasonably extensive experience programming in Excel

and Access but like I said I have no idea what to do in Outlook. If anyone

can give me a hand with this I'd be very grateful.

Thanks,

BlueWolverine

MSE - Mech. Eng.

Go BLUE!
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
The event you're looking for is the ItemAdd event of the folder for sent

items. That event fires when an item is added to the folder. There's an

example available in the VBA help file.

The added item is pased to the procedure, call its Copy function, which

returns a new item. For that you can call Move which returns the moved item.

For that call Unread=false, then Save.

Best regards

Michael Bauer

Am Mon, 17 May 2010 05:41:01 -0700 schrieb BlueWolverine:


> Hello,
> MS OUTLOOK 2003 on XP PRO.

> I would like to setup a "rule" (either a "Rules Wizard" Rule or code in


VBA)
> to make a copy of every sent email, move it to a folder and mark that copy


as
> read. I did a search on google, and found the command "Item.Unread=false"
> but I have no idea how to setup the code around it.

> I hate asking, "Can someone show me how to do the entirety of what I'm
> asking?" but I've never programmed in Outlook before and I have no idea


how
> to define an event trigger. (In access, I'd be looking for something like
> "OnEmailSent") I have reasonably extensive experience programming in


Excel
> and Access but like I said I have no idea what to do in Outlook. If


anyone
> can give me a hand with this I'd be very grateful.

> Thanks,
 
B

BlueWolverine

Thus far my code isn't even triggering. At least it's not failing or

corrupting my inbox but below is not triggering. All of the below code is in

a class module. Please help!

Initialize_handler

Dim myolApp As New Outlook.Application

Public WithEvents myOlItems As Outlook.Items

Public Sub Initialize_handler()

Set myOlItems =

myolApp.GetNamespace("MAPI").GetDefaultFolder(olFolderSentMail).Items

End Sub

Private Sub myOlItems_ItemAdd(ByVal myItem As Object)

Dim myInbox As Outlook.MAPIFolder

Dim myFolder As Outlook.MAPIFolder

Dim myNewFolder As Outlook.MAPIFolder

Set myFolder = myNameSpace.GetDefaultFolder(olFolderSentMail)

Set myInbox = myNameSpace.GetDefaultFolder(olFolderInbox)

Set myNewFolder = myInbox.Folders("EMAIL") 'EMAIL is in a PST file.

myItem.Move myNewFolder

myItem.UnRead = False

myItem.Save

End Sub

BlueWolverine

MSE - Mech. Eng.

Go BLUE!

"Michael Bauer " wrote:



> The event you're looking for is the ItemAdd event of the folder for sent
> items. That event fires when an item is added to the folder. There's an
> example available in the VBA help file.

> The added item is pased to the procedure, call its Copy function, which
> returns a new item. For that you can call Move which returns the moved item.
> For that call Unread=false, then Save.

> > Best regards
> Michael Bauer
> Category Manager -

> SAM - The Sending Account Manager:
>

> Am Mon, 17 May 2010 05:41:01 -0700 schrieb BlueWolverine:
>
> > Hello,
> > MS OUTLOOK 2003 on XP PRO.
> > I would like to setup a "rule" (either a "Rules Wizard" Rule or code in

> VBA)
> > to make a copy of every sent email, move it to a folder and mark that copy

> as
> > read. I did a search on google, and found the command "Item.Unread=false"
> > but I have no idea how to setup the code around it.
> > I hate asking, "Can someone show me how to do the entirety of what I'm
> > asking?" but I've never programmed in Outlook before and I have no idea

> how
> > to define an event trigger. (In access, I'd be looking for something like
> > "OnEmailSent") I have reasonably extensive experience programming in

> Excel
> > and Access but like I said I have no idea what to do in Outlook. If

> anyone
> > can give me a hand with this I'd be very grateful.
> > Thanks,

> .
>
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Put the code into the module ThisOutlookSession, and add this:

Private Sub Application_Startup()

Initialize_handler

end Sub

Application_Startup is the procedure called by Outlook at startup, and that

one's found only in ThisOutlookSession.

Best regards

Michael Bauer

Am Tue, 18 May 2010 07:02:01 -0700 schrieb BlueWolverine:


> Thus far my code isn't even triggering. At least it's not failing or
> corrupting my inbox but below is not triggering. All of the below code is


in
> a class module. Please help!

> Initialize_handler

> Dim myolApp As New Outlook.Application
> Public WithEvents myOlItems As Outlook.Items

> Public Sub Initialize_handler()
> Set myOlItems =
> myolApp.GetNamespace("MAPI").GetDefaultFolder(olFolderSentMail).Items
> End Sub

> Private Sub myOlItems_ItemAdd(ByVal myItem As Object)

> Dim myInbox As Outlook.MAPIFolder
> Dim myFolder As Outlook.MAPIFolder
> Dim myNewFolder As Outlook.MAPIFolder

> Set myFolder = myNameSpace.GetDefaultFolder(olFolderSentMail)
> Set myInbox = myNameSpace.GetDefaultFolder(olFolderInbox)
> Set myNewFolder = myInbox.Folders("EMAIL") 'EMAIL is in a PST


file.

> myItem.Move myNewFolder
> myItem.UnRead = False
> myItem.Save

> End Sub
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
Mary B VBscript: Need to copy every email to a folder & mark that copy as read Outlook VBA and Custom Forms 5
DoctorJellybean Outlook 365 doesn't always mark emails as read Using Outlook 3
O Office 365 Outlook - mark to download Using Outlook 0
S Codes for "Mark Complete" the task Outlook VBA and Custom Forms 2
S Mark as Unread unless Categorized by Color Using Outlook 0
Diane Poremsky Mark Sent Items as Read After Copying with a Rule New Slipstick.com Articles 0
M Mark Complete keyboard shortcut... on a mac running Windows Bootcamp Using Outlook 0
T Adding "Mark As Complete" btton to Task Remindet Pop-Up Using Outlook 3
F Automatically close email after selecting mark unread Using Outlook 1
T Outlook 2013 either fails to mark messages as read or marks them as read, then un-marks them. Using Outlook 1
C Mark all incoming emails as read Outlook VBA and Custom Forms 3
M How do I mark emails already received as read when I get a second, different email based on subject? Outlook VBA and Custom Forms 3
T outlook 2013 does not mark multiple forward messages as forward Using Outlook 2
7 Macro to mark message as junk and delete Outlook VBA and Custom Forms 3
V Mark BCC when emails is sent from specific account Outlook VBA and Custom Forms 2
B Outlook 2010: how to mark messages without opening? Eg for deletion Using Outlook 2
Z Mark moved copies as "Read" Using Outlook 19
Z "Mark All as Read" in Outlook 2007 extremely slow Using Outlook 1
N Mark or follow up emails in shared mailbox Using Outlook 2
H mark as read per folder options Using Outlook 1
C Outlook 2010 search for question mark in calendar Using Outlook 7
M Can't mark appointments as private for other user Using Outlook 1
A Mark all as read for public folders Using Outlook 14
I Pound Symbol in emails show as � (black diamond with white question mark inside) - Office 2010. Using Outlook 11
N Changing the 'Mark item as read when selection changes' at runtime Outlook VBA and Custom Forms 1
B Move Sent Email to archival pst folder and mark as read - HOW TO Outlook VBA and Custom Forms 2
J Pasting into Outlook 2003 produces blue question mark Using Outlook 2
J Mark as read Outlook VBA and Custom Forms 2
M Mark as read Outlook VBA and Custom Forms 5
R Macro to mark item unread Outlook VBA and Custom Forms 2
T Setting a delegate to not mark items as read Using Outlook 9
A Cannot copy this folder because it may contain private items Using Outlook 0
C Copy Move item won't work Outlook VBA and Custom Forms 2
B VBA to convert email to task, insert text of email in task notes, and attach copy of original email Outlook VBA and Custom Forms 4
Commodore Move turns into "copy" Using Outlook 3
C Copy Outlook contact field value to another field Outlook VBA and Custom Forms 1
J Copy to calendar function no longer working in outlook 365 Using Outlook 5
F Copy and replace not update contact in another pst Using Outlook 0
B Outlook Business Contact Manager with SQL to Excel, User Defined Fields in BCM don't sync in SQL. Can I use VBA code to copy 1 field to another? BCM (Business Contact Manager) 0
Commodore Folders always closed in move/copy items dialog box Using Outlook 3
N Outlook rules don't create a copy for bcc'ed emails Using Outlook 3
geofferyh Outlook 2010 How to Copy Outlook Attachment to a Specific Folder? Outlook VBA and Custom Forms 3
S Custom Form, copy user field data to message body Outlook VBA and Custom Forms 12
R Copy Outlook Public Folders to a File Server Shared Folder Using Outlook 0
K Outlook Rules: Move a Copy Using Outlook 4
oliv- HOW TO COPY /USE FOLDERS ICONS Outlook VBA and Custom Forms 2
E Copy e-mail body from outlook and insert into excel Outlook VBA and Custom Forms 3
B Copy/Move Exchange inbox to Pop inbox Using Outlook 4
R Sending email copy (*.msg file) of sent email if subject line contains specific string. Outlook VBA and Custom Forms 1
O Copy mails from many subfolders to 1 foldr Using Outlook 2

Similar threads

Top