Microsoft Office Tutorials and References
In Depth Information
Property
Description
HTMLBody
The text of the message (if the message is in HTML format).
Importance
Returns the importance level of the message as one of the following values:
olImportanceHigh , olImportanceLow , and olImportanceNormal .
ReceivedTime
Returns the date specifying when the message was received (as a type Date ).
Recipients
A collection of Recipient objects representing the message recipients.
Saved
True if the message has been saved since it was last modified, False otherwise.
SenderName
The display name of the message sender.
SentOn
The date when the message was sent (as a type Date ).
Subject
The message subject.
To
A semicolon-delimited list of the message recipients’ display names.
UnRead
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
characteristics.
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
Next
Search JabSto ::




Custom Search