Microsoft Office Tutorials and References
In Depth Information
The text of the message (if the message is in HTML format).
Returns the importance level of the message as one of the following values:
olImportanceHigh , olImportanceLow , and olImportanceNormal .
Returns the date specifying when the message was received (as a type Date ).
A collection of Recipient objects representing the message recipients.
True if the message has been saved since it was last modified, False otherwise.
The display name of the message sender.
The date when the message was sent (as a type Date ).
The message subject.
A semicolon-delimited list of the message recipients’ display names.
Returns True if the message has not been opened. False if it has been.
Next look at some examples of writing macros to perform useful, everyday tasks in Outlook.
Moving Selected Messages
One way you can use macros is to go through any folder containing email messages, typically the
Inbox, and move messages to various other folders depending on their sender, subject, or other
The first step in doing this is to get a reference to both folders. You have already seen how to get a
reference to the Inbox using the GetDefaultFolder() method, and how to get a reference to
a user-created folder using the FindFolder() procedure presented earlier in this chapter.
Next you must loop through all the messages in the Inbox, checking each one to see whether it
meets the criterion for being moved. You use a For Each...Next loop for this purpose. For this
code snippet, assume that:
n fInbox is a reference to the Inbox.
n The variable m has been declared as type Outlook.MailItem .
n The variable Subject holds the text you want to look for.
For Each m In fInbox.Items
If InStr(m.Subject, Subject) > 0 Then
‘ Move the message here.
End If
Search JabSto ::

Custom Search