A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Mark copy of sent email as read - VBA?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 17th 10, 02:41 PM posted to microsoft.public.outlook.program_vba
BlueWolverine
external usenet poster
 
Posts: 7
Default Mark copy of sent email as read - VBA?

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!
Ads
  #2  
Old May 18th 10, 08:46 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default Mark copy of sent email as read - VBA?



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 - MVP Outlook
Category Manager - Manage and share your categories:
SAM - The Sending Account Manager:
http://www.vboffice.net/product.html?lang=en


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,

  #3  
Old May 18th 10, 04:02 PM posted to microsoft.public.outlook.program_vba
BlueWolverine
external usenet poster
 
Posts: 7
Default Mark copy of sent email as read - VBA?

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(olFo lderSentMail).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 [MVP - Outlook]" 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 - MVP Outlook
Category Manager - Manage and share your categories:
SAM - The Sending Account Manager:
http://www.vboffice.net/product.html?lang=en


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,

.

  #4  
Old May 19th 10, 09:04 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default Mark copy of sent email as read - VBA?



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 - MVP Outlook
Category Manager - Manage and share your categories:
SAM - The Sending Account Manager:
http://www.vboffice.net/product.html?lang=en

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(olFo lderSentMail).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

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mark as read mkboynton via OfficeKB.com Outlook and VBA 5 June 17th 09 10:59 PM
Mark Sent as Read Dave Outlook and VBA 3 September 16th 08 04:02 PM
VBA to move outbound email and mark as read? [email protected] Outlook and VBA 11 May 2nd 06 04:07 PM
Mark as read Sven Berg Outlook - General Queries 1 February 8th 06 10:20 AM
Outlook 2003 - automatically mark all Junk email as "read" Ric Outlook - General Queries 8 January 19th 06 02:52 PM


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


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.