IMAddress Property

Microsoft Outlook Visual Basic

expression.IMAddress

expression    Required. An expression that returns a ContactItem object.

Remarks

Unlike the Recipients or To properties, there is no way to verify that the IMAddress property contains a valid address.

Outlook blocks code that attempts to access the Recipients object for security reasons. If you run a third-party add-in, custom solution, or other program that uses the Recipients object in Office Outlook 2003, you may receive the following warning:

A program is trying to access e-mail addresses you have stored in Outlook. Do you want to allow this? If this is unexpected, it may be a virus and you should choose "No".

Example

The following example creates a new contact and prompts the user to enter an Instant Messenger address for the contact.

Sub SetImAddress()
'Sets a new IM Address

    Dim olApp As Outlook.Application
    Dim objNewContact As ContactItem

    Set olApp = Outlook.Application
    Set objNewContact = olApp.CreateItem(olContactItem)
    objNewContact.IMAddress = _
        InputBox("Enter the new contact's Microsoft Instant Messenger address")
    objNewContact.Save
End Sub