View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Fredrik Wahlgren Fredrik Wahlgren is offline
external usenet poster
 
Posts: 339
Default Reference Libraries


"ben" (remove this if mailing direct) wrote in message
...
I use excel to control mailing of workbooks automatically using outlook.

So
in my excel file I have the Outlook 11.0 reference file added in which

is
associated with Outlook 2003, Unfortunately I have people using Outlook

2000
also which is using Outlook 9.0 reference library. When the excel workbook

is
run a machine with outlook 2000 every macro errors because the reference

to
the Outlook 11.0 library is not found. Is there a way to include backwards
compabtibilty here???????
Please help....
ben
--
When you lose your mind, you free your life.


I think so. When you have a reference set, you use what is known as early
binding, Thismeans that you can declare a varible to that object as Dim o As
Outlook.Application without VBA making a complaint. VBA can now make use of
Intellisense to show all the methods offered by Outlook.

I think you should be able to use late binding. This means that you remove
the reference to outlook and then have code similar to this

Dim o As Object
Set o = CreateObject("Outlook.Application")

You won't have Intellisense but the code should now work with either version
as long as you don't try to call a method that exists in one version only.
To make coding easier, do this change as the last step.

/Fredrik