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

Macro to mark item unread



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 26th 09, 06:38 PM posted to microsoft.public.outlook.program_vba
Dave
external usenet poster
 
Posts: 247
Default Macro to mark item unread

Hi:

I have a very simple macro that moves the selected item to a folder called
"Archive - email". I also want the macro to mark the selected item "read".
I'm pretty sure I simply need to set "unread" to false and then save the item
- but I can't figure out how to do so. Any help would be appreciated.

Dave

Sub MoveToArchive()
MoveToFolder ("Archive - email")
End Sub
Ads
  #2  
Old May 26th 09, 10:08 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Macro to mark item unread

I assume your MoveToFolder() method does something like grabbing
ActiveExplorer.Selection(1)? Just assign that item to an object (or specific
item type such as MailItem, if the macro will always be used on a specific
type of item). Then set the Unread property to false.

Dim obj As Object
Set obj = Application.ActiveExplorer.Selection(1)
obj.Unread = False
obj.Save
Set obj = Nothing

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Dave" wrote in message
...
Hi:

I have a very simple macro that moves the selected item to a folder called
"Archive - email". I also want the macro to mark the selected item "read".
I'm pretty sure I simply need to set "unread" to false and then save the
item
- but I can't figure out how to do so. Any help would be appreciated.

Dave

Sub MoveToArchive()
MoveToFolder ("Archive - email")
End Sub


  #3  
Old May 27th 09, 02:25 PM posted to microsoft.public.outlook.program_vba
Dave
external usenet poster
 
Posts: 247
Default Macro to mark item unread

Perfect. Here's the code I used in case it's of use to anyone else. (One
could also put error handling in to warn the user if the folder doesn't exist
or to create it if it doesn't exist...)

Thanks a million.

Dave

' Move the selected message(s) to folder "Archive - email"
Sub MoveToArchive()
Dim obj As Object
Set obj = Application.ActiveExplorer.Selection(1)
obj.UnRead = False
obj.Save
Set obj = Nothing
MoveToFolder ("Archive - email")
End Sub



"Ken Slovak - [MVP - Outlook]" wrote:

I assume your MoveToFolder() method does something like grabbing
ActiveExplorer.Selection(1)? Just assign that item to an object (or specific
item type such as MailItem, if the macro will always be used on a specific
type of item). Then set the Unread property to false.

Dim obj As Object
Set obj = Application.ActiveExplorer.Selection(1)
obj.Unread = False
obj.Save
Set obj = Nothing

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Dave" wrote in message
...
Hi:

I have a very simple macro that moves the selected item to a folder called
"Archive - email". I also want the macro to mark the selected item "read".
I'm pretty sure I simply need to set "unread" to false and then save the
item
- but I can't figure out how to do so. Any help would be appreciated.

Dave

Sub MoveToArchive()
MoveToFolder ("Archive - email")
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
Create a rule to mark message as UNREAD when arrived ? Luqman Outlook - General Queries 4 February 26th 08 09:45 PM
How do I mark specific contacts as unread? Ryan212 Outlook - Using Contacts 4 October 17th 07 02:16 AM
New message not be mark unread..Why.. Kevin\(§d¤åµ{\) Outlook - General Queries 0 January 26th 07 02:11 AM
Rule to mark UNREAD Menachem Bazian Outlook - General Queries 3 August 19th 06 07:48 PM
mark unread as long as mail is in this folder sami.s Outlook - General Queries 2 January 25th 06 01:37 PM


All times are GMT +1. The time now is 02:42 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.