Here is some code that I have used in an Excel file because I didn't know
what version of Outlook the users were going to be using:
#If EarlyBinding = 1 Then
Public objOLapp As Outlook.Application
Public objOLitem As Outlook.MailItem
#Else
Public objOLapp As Object
Public objOLitem As Object
#End If
Quoted from David Horowitz:
Where EarlyBinding is a compiler option in the project properties
(Tools/Properties for ...). When I develop I use EarlyBinding = 1 and have a
reference to the, in this case, version of Outlook on my computer. You have
all the method and properties with intellisense at your disposal. When
delivering the app I erase the references and set the compiler option to
EarlyBinding = 0. And voila, no changes to the code because of the public
declarations (object and constants) and RUN!