'What are all the properties that I can assign to "with Outlook" with VBA?

In VBA we can create an object to run and manipulate other applications. I am trying to do a few jobs in Outlook with code in Excel.

Eg -

With OutMail
    .Subject = " Event 1 "
    .Importance = True
    .Start = "8:00 AM" & Format(Date + 5)
    .End = "8:00 AM" & Format(Date + 5)
    .Body = "This is a testing event 1 msg " & Format(Date)
    .Display
    .Save
End With

Here I have used a few properties I know like .subject, .start, .save, .display etc.

I am interested to know all the properties that I can set in Outlook using the "with Outlook" command.



Solution 1:[1]

You can refer to this msdn page for descriptions of the methods and properties of the MailItem object.

To make writing the code easier, you can use the Object Browser as Bathsheba suggests by declaring your MailItem instance using early binding instead of late binding. To do this, add a reference to outlook in your project by clicking "Tools" ---> "References..." and checking the box next to Microsoft Outlook 14.0 Object Library. You can then declare the MailItem by:

Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem

Set OutApp = New Outlook.Application
Set OutMail = OutApp.CreateItem(olMailItem) 'olMailItem is 0

Once you have declared OutMail as above, the VBA IDE will show you the members in the Object Browser and also give you intellisense as you code.

Solution 2:[2]

Use the object browser, available from F2 in the VBA development screen.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Blackhawk
Solution 2 Bathsheba