From: dhstein on
I have the following macro to mark all messages as read. I want to call it
with a list so that it will run for several folders. What syntax would I
use? Thanks.

Sub ChangeToRead()

Dim objInbox As Outlook.MAPIFolder
Dim objOutlook As Object, objnSpace As Object, objMessage As Object
Dim objSubfolder As Outlook.MAPIFolder

Set objOutlook = CreateObject("Outlook.Application")
Set objnSpace = objOutlook.GetNamespace("MAPI")
Set objInbox = objnSpace.GetDefaultFolder(olFolderInbox)
'Set objSubfolder = objInbox.Folders.Item("Test")
Set objSubfolder = Application.ActiveExplorer.CurrentFolder

For Each objMessage In objSubfolder.Items
objMessage.UnRead = False
Next

Set objOutlook = Nothing
Set objnSpace = Nothing
Set objInbox = Nothing
Set objSubfolder = Nothing


End Sub

From: Michael Bauer [MVP - Outlook] on


See you own code, it demonstrates how to call a subfolder of the inbox, for
instance.

--
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 Fri, 30 Apr 2010 08:44:02 -0700 schrieb dhstein:

> I have the following macro to mark all messages as read. I want to call
it
> with a list so that it will run for several folders. What syntax would I
> use? Thanks.
>
> Sub ChangeToRead()
>
> Dim objInbox As Outlook.MAPIFolder
> Dim objOutlook As Object, objnSpace As Object, objMessage As Object
> Dim objSubfolder As Outlook.MAPIFolder
>
> Set objOutlook = CreateObject("Outlook.Application")
> Set objnSpace = objOutlook.GetNamespace("MAPI")
> Set objInbox = objnSpace.GetDefaultFolder(olFolderInbox)
> 'Set objSubfolder = objInbox.Folders.Item("Test")
> Set objSubfolder = Application.ActiveExplorer.CurrentFolder
>
> For Each objMessage In objSubfolder.Items
> objMessage.UnRead = False
> Next
>
> Set objOutlook = Nothing
> Set objnSpace = Nothing
> Set objInbox = Nothing
> Set objSubfolder = Nothing
>
>
> End Sub