PC Review
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook VBA Programming
Macro to Mark Messages As Read
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook VBA Programming
Macro to Mark Messages As Read
![]() |
Macro to Mark Messages As Read |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
This Damsel is Perplexed - A macro that when activated, will mark messages
as read. Using Outlook 2000, with the security setting as Medium. The messages are sent via a Rule, utilizing Rules Wizard, the user has an email with specific Text in the subject line, a copy is sent to a specific folder. When they are sent to this folder it will mark the messages as unread. Is there anyway to automate this so it happens automatically without using a button. Here is the code created for the automation: private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) run macro = prjMarkAsRead.mcrMarkAsRead End Sub |
|
|
|
#2 |
|
Guest
Posts: n/a
|
private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) run macro = prjMarkAsRead.mcrMarkAsRead ----------------------------------------------------------- in this outlook session ------------------------------------------------------------ Option Explicit 'set up outlook references Dim outNameSpace As NameSpace Public WithEvents OutItems As Outlook.Items Private Sub outItems_ItemAdd(ByVal Item As Object) On Error Resume Next DoEvents 'make sure mail item in folder If TypeName(Item) = "MailItem" Then 'set to read With Item .UnRead = false .Save End With end sub ------------------------------------------------------------ rough draft but should be close Woody I am not responsible for anything you may see with my name attached to it, i think. *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
|
|
|
#3 |
|
Guest
Posts: n/a
|
Hi, Sue,
I want to mark any message placed in my "Junk E-Mail" folder as read. How do I do it? I can't find anywhere on this newsgroup where this question has been answered. Could you perhaps provide that answer? Thanks! Philip Brown |
|
|
|
#4 |
|
Guest
Posts: n/a
|
Sub MarkRead()
'coded in outlook 2002 'some code taken from other usergroups, fyi Dim app As New Outlook.Application Dim ns As NameSpace Set ns = app.GetNamespace("MAPI") 'Debug.Print ns.CurrentUser.Name FindtoMark ns.Folders, 0 End Sub Sub FindtoMark(parent As Folders, depth As Integer) Dim flr As MAPIFolder Dim s As String s = String(depth * 2, " ") For Each flr In parent 'Debug.Print s; flr.Name; ": "; flr.DefaultMessageClass; 'mark all as read in a particular folder. If flr.Name = "Your folder name" Then For Each objMailItem In flr.Items 'If objMailItem.SenderName = "Spammer Name" Then If objMailItem.UnRead = True Then objMailItem.UnRead = False End If 'End If Next End If ListFolder flr.Folders, depth + 1 DoEvents Next flr End Sub ------------------------------------------------ ~~ Message posted from http://www.OutlookForum.com/ ~~ View and post usenet messages directly from http://www.OutlookForum.com/ |
|
|
|
#5 |
|
Guest
Posts: n/a
|
This is GREAT! Now how do you get it to auto-run everytime you get mail? Or get mail in the specified folder? Thanks! Doc ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www.ExcelForum.com/ |
|
|
|
#6 |
|
Guest
Posts: n/a
|
Actually it's simpler than I thought: Sub Application_NewMail() MarkRead End Sub Thanks again! Doc ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www.ExcelForum.com/ |
|
|
|
#7 |
|
Guest
Posts: n/a
|
Welcome ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com |
|
|
|
#8 |
|
Guest
Posts: n/a
|
Hi! I am new to VBA Macros. I'd like to implement this in my Outlook 2000 I have no idea how to do so? Could anyone give me step by ste instructions. Thank you! Rega ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com |
|
|
|
#9 |
|
Guest
Posts: n/a
|
(1) On your menu bar, go to tool...macros (2) In the text box for macro name, type in "MarkRead" (without th quotation marks.) (3) Push the "create" button (4) Paste the code from above straight into the vba editor. (5) Type in the folder name from "Your Folder Name" to whatever th real name of the folder is. fyi, you can access multiple folders in the same module with the code If flr.Name = "Your Folder Name" Or flr.Name = "Your Second Folde Name" or flr.Name = "Your Third Folder Name" The ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com |
|
|
|
#10 |
|
Guest
Posts: n/a
|
Terrific!!!!!!! Thanks!!!!!!! ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

