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.
Thread starter Similar threads 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
R Outlook 2010 Quick Steps - Mark as Read Action and New Mail Notification Using Outlook 1
L Outlook / messages not mark as been read Using Outlook 1
C Outlook 2003 Exclamation Mark Using Outlook 1
K clicking "completed" icon doesn't mark task complete. Using Outlook 2
M Mail rules: "Mark as read" doesn't work... Using Outlook 1
J Change 'Mark As Read' Status Without using Reading Pane Using Outlook 1
S How do I mark an email I want to send as 'private'? Using Outlook 2
L Apostrophe becomes question mark when posting to a new group using Windows Live mail Using Outlook 3
D Outlook 2010 - Mark Unread button isn't always in the correct state Using Outlook 4
M Mark mail as read on Hotmail server using Connector Using Outlook 2
H Outlook 2007 Errors-Out/Restarts Trying to Print an Email with MS-Word Mark-Up Area Using Outlook 1
D In the last few days I get error message box indicating with a Red X mark and 'This operaion has been cancelled due to restriction on this comput Using Outlook 3
S Flagging Messages - Cannot 'Mark Complete'! Using Outlook 1
K Right-Click to Mark ALL as Read on (Exchange) Public Folder Using Outlook 1
F Mark RSS as read Using Outlook 1
J Paragraph Mark Using Outlook 1
J being able to mark read messages to unread using a Macbook that uses Safari in OWA Using Outlook 2
J Be able to mark email as unread in OWA Using Outlook 2
S Mark all as read not working for RSS feeds Using Outlook 1
J Exchange 2010: Microsoft Outlook Web App: How do you mark specific emails as junk? Exchange Server Administration 1
J Conflict between "Unread Mail" and "Mark items as read when viewed in the reading pane" Using Outlook 2
A Mark all as read for public folders Using Outlook 14
S Outlook message subject changed to question mark after importing pst. ??????? Exchange Server Administration 2
E aol emails automatic mark as read and delete__ Using Outlook 1
J Mark recurring event as completed for individual event Using Outlook 1
I Pound Symbol in emails show as � (black diamond with white question mark inside) - Office 2010. Using Outlook 11
J Outlook 2010 - IMAP "Mark items for deletion" does not work Using Outlook 4
N Changing the 'Mark item as read when selection changes' at runtime Outlook VBA and Custom Forms 1
Similar threads


















































Top