General Com Add-in Advice

K

Kristy

Hi

I have written a com add-in for Outlook in VB6 (2000 and XP). One of
the features of the Add-in enables the creation of emails with
embedded graphics, company wide signature blocks etc.

This option is also available from Word, Excel and PPT, (ie, you can
send documents as attachments from Word, Excel, PPT on the customised
email). Currently I do this by using one DLL that has 4 Designers
(one each for Outlook, Word, PPT and Excel). Each is loaded at
startup so that they can then freely use the Email creation code when
required.

This seems to work really well, but I would like to ensure that I am
using the best practices possible so could someone advise if this is
in fact the best, most reliable, stable method to use or if I should
actually be using 4 separate DLL's and use 'AddInInst.Object = Me' to
call the required subs from the Outlook dll when needed.

Also, I use subMain to check some details (and run a splash screen)
before I actually load the dll itself. Is it possible to tell which
Application has started and therfore caused Sub Main to run (sub main
runs before the on_connection event is fired but it must know that an
application has been opened or it wouldn't run Sub Main)? I've tried
Dim oHostApp as Object, Set oHostApp as Application in Sub Main, but
this doesn't work.

Thanks

Kris
 
K

Ken Slovak - [MVP - Outlook]

You can use multiple designers but I'd probably use separate ones, at
least for Outlook. Outlook COM addins are somewhat different than
addins for other Office apps.

You can try using GetObject in your main code against all the object
models you are supporting but if the user has more than one app open
GetObject would succeed for more than one:

Set oOL = GetObject(, "Outlook.Application")
If oOL Is Nothing Then
'Outlook not started
End If

Also, for Outlook COM addins make sure you download and examine the
ItemsCB COM addin sample in VB6 on the Resources page at
www.microeye.com for a look at best practices and workarounds for
Outlook COM addins.
 

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