Outlook COM Addin for multiple versions

E

Eran Yaron

i want to build a com addin for outlook that will catch the itemsend event.



for that im declating a var name outlookapp with events as
outlook.application.



my problem is that in order to define it as outlook.application i have to
add outlook as a reference. this can cause problems cause the clients using
this addin may have different versions of outlook (2k, xp, 2k3), and if they
dont have the same version of the reference file as i used it wont work
correctly. so the main question here how can i do this without making a
different version of the com addin for each outlook version.



i tried to look this up on the web but i couldnt find any answers.



thanks for any help that you can give...
 
K

Ken Slovak - [MVP - Outlook]

Compile the code with the oldest version of Outlook your users will be
using. It will work with the later versions. I compile with Outlook 2000 and
the code works for that and Outlook 2002 and 2003. The only thing is if you
want to use something that's not in an earlier version you'd have to test
the version (Outlook.Application.Version) and late bind any properties that
aren't in the earlier version of Outlook.
 
E

Eran Yaron

so basically just add a reference to the old outlook.exe file in my project
and thats it?

i thought of that but it seemed to simple :)

thanks
 
K

Ken Slovak - [MVP - Outlook]

No, you will need to compile on a machine that has say Outlook 2000
installed on it if you want to support Outlook 2000 and later so the
outlook.tlb file is installed on that machine. You can't really have
multiple copies of the tlb installed or things won't work correctly.

I use VMWare on my main development computer and have a VM installed with
Outlook 2000. I then compile on that VM.

The alternative is to late bind all your Outlook objects (Dim objWhatever As
Object) but then you don't get the intellisense and other helpers for your
object properties, methods and events.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top