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!
 
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,
 
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,

> .
>
 
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
Kika Melo How to mark as Junk any message not from Contacts (in Outlook.com) Using Outlook 3
K mark emails with colour manually (like in thunderbird) Using Outlook 1
V Macro to mark email with a Category Outlook VBA and Custom Forms 4
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 Using Outlook 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
C Copy from one Profile to another Using Outlook 0
M "Attachment Detacher for Outlook" add in, does it update the server copy of the email? Using Outlook 1
C Outlook 365 Copy/Save Emails in Folder Outside Outlook to Show Date Sender Recipient Subject in Header Using Outlook 0
D Copy Appointment Body to Task Body Outlook VBA and Custom Forms 0
M copy field value to custom field Outlook VBA and Custom Forms 0
O In Agenda-view - How to copy an existing item months ahead or back? Using Outlook 0
C Move or copy from field to field Outlook VBA and Custom Forms 0
Z Copy specific email body text Outlook VBA and Custom Forms 0
B Need to Copy an email to a subfolder Outlook VBA and Custom Forms 2
O Outlook 365 - How to create / copy a new contact from an existing one? Using Outlook 5
S Copy Tasks/Reminders from Shared Mailbox to Personal Tasks/Reminders Outlook VBA and Custom Forms 0
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
Z 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

Similar threads

Back
Top