COM addin won't run code on connection

J

Justin Leonard

I've built a COM addin for Outlook 2002 in VBA that I want to load on
startup and immediately display a form that's in the addin. When I try to
debug it and create a new instance of outlook I see in the addin manager
that the addin has loaded but the form doesn't run. I tried putting Load
LoginForm and LoginForm.Show in the IDTExtensibility2_OnConnection and
OnStartupComplete handlers but to no avail (message boxes and debug.print
statements in those handlers also do not run). I also tried Private
p_LoginForm As LoginForm in add-in designer declarations and Set p_LoginForm
= New LoginForm, p_LoginForm.cmdLogin.Enabled = False, p_LoginForm.Show in
Private Sub AddinInstance_Initialize().

I have checked that the VBA window says [published], and I have clicked the
window of each open instance of Outlook. I know that I have done nothing in
Outlook to call this addin but I don't understand why the code in the
OnConnection handler doesn't run. Since this is a login function that runs
on Outlook startup and that I'll distribute to remote users, there's no easy
way to, say, call it from the ThisOutlookApplication module since there's no
easy way I know to redistribute that (and the whole reason I've created this
addin is to address that shortcoming).

Any advice? Thanks much.
 
P

psb

Try:
LoginForm.Show vbModal

Then make sure you connection.dsr is set to open on
startup.
Check the code on the form. Design a new form real quick
and just put form_load() event in it, then run that. If
that work, it probably means your form is not workign
right. Build and test, build and test...

-We develop COM add-ins too! www.abistech.com
-----Original Message-----
I've built a COM addin for Outlook 2002 in VBA that I want to load on
startup and immediately display a form that's in the addin. When I try to
debug it and create a new instance of outlook I see in the addin manager
that the addin has loaded but the form doesn't run. I tried putting Load
LoginForm and LoginForm.Show in the
IDTExtensibility2_OnConnection and
OnStartupComplete handlers but to no avail (message boxes and debug.print
statements in those handlers also do not run). I also tried Private
p_LoginForm As LoginForm in add-in designer declarations and Set p_LoginForm
= New LoginForm, p_LoginForm.cmdLogin.Enabled = False, p_LoginForm.Show in
Private Sub AddinInstance_Initialize().

I have checked that the VBA window says [published], and I have clicked the
window of each open instance of Outlook. I know that I have done nothing in
Outlook to call this addin but I don't understand why the code in the
OnConnection handler doesn't run. Since this is a login function that runs
on Outlook startup and that I'll distribute to remote users, there's no easy
way to, say, call it from the ThisOutlookApplication module since there's no
easy way I know to redistribute that (and the whole reason I've created this
addin is to address that shortcoming).

Any advice? Thanks much.

.
 

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