G
Guest
What would the VBA function and code be to Mark All As Read at the FOLDER
level vs. looping through all messages within each folder.
My code so far is:
Sub SetEmailsToRead()
Dim olApp As Outlook.Application
Dim itm As TaskItem
Dim olNS As NameSpace
Dim renxFolder As MAPIFolder
Dim renderxSubFolder As MAPIFolder
Dim flds As Folders
Dim idx As Integer
Dim msgResult As Integer
Dim msgBoxStyle As Integer
'
Set olApp = Outlook.Application
Set olNS = olApp.GetNamespace("MAPI")
'
'Set Error event processing
On Error GoTo errorSetEmailToRead
'
'Set the Folder path to processed
Set renxFolder = _
olNS.Folders("Personal Folders").Folders("XBS")
'
olNS.Folders("RenderX").Folders("Sales").Folders("Pipeline").Folders("00-Prospect")
'Set the folder object
Set flds = renxFolder.Folders
'Get the first Folder
Set renxSubFolder = flds.GetFirst
'Repeat while we have a folder in the path
Do While Not renxSubFolder Is Nothing
MsgBox (renxSubFolder)
'
'
'NEED TO FIND HOW TO SET ALL EMAIL'S IN A FOLDER'S TO READ
'THE FUNCTION CAN BE DONE MANUALLY AT THE FOLDER LEVEL, NOT NEEDING TO SET
EACH EMAIL
'IN THE FOLDER TO READ
'
'
'Set the next folder in the path
Set renxSubFolder = flds.GetNext
Loop
'
'Display info msg - processing completed
msgBoxStyle = vbOKOnly Or vbInformation
msgResult = MsgBox("Processing completed.", msgBoxStyle, "Set Emails To
Read")
'Exit subroutine
Exit Sub
'
'Error processing
errorSetEmailToRead:
' Check for error, then show message.
If Err.Number <> 0 Then
msgBoxStyle = vbOKOnly Or vbExclamation
msgResult = MsgBox("Error #" & Str(Err.Number) & "was generated by " _
& Err.Source & Chr(13) & Err.Description, msgBoxStyle, "Set
Emails To Read")
End If
'End and Exit
End Sub
Thank you very much for your help.
level vs. looping through all messages within each folder.
My code so far is:
Sub SetEmailsToRead()
Dim olApp As Outlook.Application
Dim itm As TaskItem
Dim olNS As NameSpace
Dim renxFolder As MAPIFolder
Dim renderxSubFolder As MAPIFolder
Dim flds As Folders
Dim idx As Integer
Dim msgResult As Integer
Dim msgBoxStyle As Integer
'
Set olApp = Outlook.Application
Set olNS = olApp.GetNamespace("MAPI")
'
'Set Error event processing
On Error GoTo errorSetEmailToRead
'
'Set the Folder path to processed
Set renxFolder = _
olNS.Folders("Personal Folders").Folders("XBS")
'
olNS.Folders("RenderX").Folders("Sales").Folders("Pipeline").Folders("00-Prospect")
'Set the folder object
Set flds = renxFolder.Folders
'Get the first Folder
Set renxSubFolder = flds.GetFirst
'Repeat while we have a folder in the path
Do While Not renxSubFolder Is Nothing
MsgBox (renxSubFolder)
'
'
'NEED TO FIND HOW TO SET ALL EMAIL'S IN A FOLDER'S TO READ
'THE FUNCTION CAN BE DONE MANUALLY AT THE FOLDER LEVEL, NOT NEEDING TO SET
EACH EMAIL
'IN THE FOLDER TO READ
'
'
'Set the next folder in the path
Set renxSubFolder = flds.GetNext
Loop
'
'Display info msg - processing completed
msgBoxStyle = vbOKOnly Or vbInformation
msgResult = MsgBox("Processing completed.", msgBoxStyle, "Set Emails To
Read")
'Exit subroutine
Exit Sub
'
'Error processing
errorSetEmailToRead:
' Check for error, then show message.
If Err.Number <> 0 Then
msgBoxStyle = vbOKOnly Or vbExclamation
msgResult = MsgBox("Error #" & Str(Err.Number) & "was generated by " _
& Err.Source & Chr(13) & Err.Description, msgBoxStyle, "Set
Emails To Read")
End If
'End and Exit
End Sub
Thank you very much for your help.