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

VBA to move outbound email and mark as read?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old April 19th 06, 02:57 PM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 10
Default VBA to move outbound email and mark as read?

Using Outlook 2003, how would I create a custom rule to move outbound
email to a specific folder and mark as read? Similar questions have
popped up several times before, e.g.:

http://groups.google.com/group/micro...c9278193fa52c3
http://groups.google.com/group/micro...b8d0891b74ea23

But I haven't found any clear, simple answers. It is odd that Outlook
doesn't have a "mark as read" action to begin with, but since that
seems to be the case, can someone point me to a step-by-step
explanation for how to create a custom action in VBA that marks the
message as read and then associate that action with a rule in the Rules
Wizard?

The only other option seems to be going through all of the folders to
which sent mail has automatically been moved and doing 'mark all as
read' every day or every few hours, which would be quite inefficient.

Ads
  #2  
Old April 19th 06, 08:45 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default VBA to move outbound email and mark as read?

How are your Sent Items being marked as unread anyway?

You can use code as outlined in my blog:

Macro Magic - Changing the location of the save sent message folder:
http://blogs.officezealot.com/legaul...05/11/214.aspx

You can also fire a macro with a rule:

How to create a script for the Rules Wizard in Outlook:
http://support.microsoft.com/default...;en-us;q306108

To change the read/unread state of a message, use the Unread property.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


" wrote:

Using Outlook 2003, how would I create a custom rule to move outbound
email to a specific folder and mark as read? Similar questions have
popped up several times before, e.g.:

http://groups.google.com/group/micro...c9278193fa52c3
http://groups.google.com/group/micro...b8d0891b74ea23

But I haven't found any clear, simple answers. It is odd that Outlook
doesn't have a "mark as read" action to begin with, but since that
seems to be the case, can someone point me to a step-by-step
explanation for how to create a custom action in VBA that marks the
message as read and then associate that action with a rule in the Rules
Wizard?

The only other option seems to be going through all of the folders to
which sent mail has automatically been moved and doing 'mark all as
read' every day or every few hours, which would be quite inefficient.


  #3  
Old April 20th 06, 02:16 AM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 10
Default VBA to move outbound email and mark as read?

How are your Sent Items being marked as unread anyway?

Interestingly, every time this issue comes up -- I found about 6 or 7
threads with similar questions -- someone is always surprised that Sent
Items are being marked as unread. I don't understand why this is
surprising. If you go into the Rules Wizard and create a new Rule to
apply to outgoing messages that moves them to a different folder based
on, e.g., a string in the recipient, the message in that different
folder will be marked unread. There will also be duplicate messages in
your "sent items" folder (thus "move" is really a misnomer--it is, in
fact, copying the message). The only way I could figure out to prevent
that from happening was to disable the option to save messages to "sent
items;" have the rules for filtering outbound messages to certain
folders stop processing further rules after the match; and then have a
last "catch all" rule that moves all messages to "sent items."

I will check out your blog, though, thanks for the tip.

  #4  
Old April 20th 06, 02:33 AM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 10
Default VBA to move outbound email and mark as read?

On further inspection, it looks like your blog is providing a different
solution: the ability to decide the sent mail folder at the time you
send the message. What I'm looking for is a way to have messages
automatically recognized (by a rule) as to which "sent mail" folder
they belong to.

What I'm stuck on is getting a script to appear as a "custom action" in
the Rules Wizard. I checked out that knowledge base article, but no
matter what I do in the VBA window (even saving and restarting
outlook), my new subroutines do not appear as custom actions. The
script I'm attempting to use as a custom action is very simple:

Sub MarkRead_CustomAction(Item As Outlook.MailItem)
Item.UnRead = False
Item.Save
End Sub

Any idea why it doesn't show up as a custom action?

  #5  
Old April 20th 06, 04:41 AM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default VBA to move outbound email and mark as read?

I pasted your procedure into the ThisOutlookSession module, saved the VBA
project and compiled it - it was then visible in the list for the "Run a
script" rule. Heck, saving and compiling doesn't even matter with a second
dummy procedure that I added which got listed right away as well.

Sorry, I have no idea why this isn't working for you.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


" wrote:

On further inspection, it looks like your blog is providing a different
solution: the ability to decide the sent mail folder at the time you
send the message. What I'm looking for is a way to have messages
automatically recognized (by a rule) as to which "sent mail" folder
they belong to.

What I'm stuck on is getting a script to appear as a "custom action" in
the Rules Wizard. I checked out that knowledge base article, but no
matter what I do in the VBA window (even saving and restarting
outlook), my new subroutines do not appear as custom actions. The
script I'm attempting to use as a custom action is very simple:

Sub MarkRead_CustomAction(Item As Outlook.MailItem)
Item.UnRead = False
Item.Save
End Sub

Any idea why it doesn't show up as a custom action?


  #6  
Old April 20th 06, 02:02 PM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 10
Default VBA to move outbound email and mark as read?

Does anyone know if there is some type of security setting that might
be blocking my custom procedures in ThisOutlookSession from becoming
available as custom actions?

  #7  
Old April 20th 06, 04:27 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default VBA to move outbound email and mark as read?

If you can run other macros, then your security settings are configured
properly.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


" wrote:

Does anyone know if there is some type of security setting that might
be blocking my custom procedures in ThisOutlookSession from becoming
available as custom actions?


  #8  
Old May 1st 06, 01:40 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default VBA to move outbound email and mark as read?

VBA procedures are never available as custom actions. Custom actions are separate .dlls built with C++ or Delphi and Extended MAPI. Maybe you're confusing rule custom actions with the CustomAction event on an Outlook item, which is related to the user choosing an action from the Response toolbar? Or with the "run a script" rule action?

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

wrote in message ups.com...
Does anyone know if there is some type of security setting that might
be blocking my custom procedures in ThisOutlookSession from becoming
available as custom actions?

  #9  
Old May 1st 06, 02:27 PM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 10
Default VBA to move outbound email and mark as read?

I think the problem is that "run a script" is available as an action in
a rule to process incoming mail, but not outgoing mail. Is there some
reason for this difference?

  #10  
Old May 1st 06, 02:41 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default VBA to move outbound email and mark as read?

Just guessing, it's to avoid confusion and problems related to whether the rule script would run against the item before the send is completed or after.

Code for outgoing items can be handled by the Application_ItemSend event handler or by monitoring the Sent Items folder for new items with the MAPIFolder.Items.ItemAdd event, depending on the application.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

wrote in message oups.com...
I think the problem is that "run a script" is available as an action in
a rule to process incoming mail, but not outgoing mail. Is there some
reason for this difference?

 




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
Rule to Move to Folder AFTER being Read yelnocer Outlook - Installation 1 March 12th 06 11:40 PM
Using VBA code to move current message to a folder Dean Outlook and VBA 4 February 26th 06 01:46 AM
Mark as read Sven Berg Outlook - General Queries 1 February 8th 06 09:20 AM
Outlook 2003 - automatically mark all Junk email as "read" Ric Outlook - General Queries 8 January 19th 06 01:52 PM
Mark as Read? After x seconds? HotRod Outlook - General Queries 2 January 12th 06 07:22 PM


All times are GMT +1. The time now is 05:04 AM.


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.