COM AddIn 
Author Message
 COM AddIn

Hello.

I am trying to write a COM addin for Outlook using VBA. I
have set up the designer so that the AddIn is loaded at
startup.

So far, the addin contains no code, except for a single
line in OnConnection:

Set App = Application

I am using Outlook through automation in Access. While the
addin is activated, the CreateObject() call in Access
returns the error "ActiveX component can't create object".
If I disable the addin, or replace the Set statement with
a MsgBox() call, then the automation call succeeds. I know
that my code is called, because of the message box.

Running outlook as a standalone program produce no error,
and if outlook has already been started, then there is no
error on automation either.

Any suggestions are appreciated.

Regards,
Ivar Svendsen.



Sun, 31 Jul 2005 07:44:55 GMT  
 COM AddIn
Hello.

I found out this myself:

If you write this code -

AddinInstance_OnStartupComplete(custom())
 dim m_Folders as Folders
 set m_Folders = olApp.GetNameSpace("MAPI").Folders
 '
 ' Do something whith m_Folders
 '
 set m_Folders = Nothing
exit sub

- then you cannot create an automation object of Outlook
from another program, because Outlook will puke when the
m_Folders object is released.

Apparently, Outlook does NOT maintain a correct reference
count on some objects, and does strange things when the
Folders collection is released.

To make my AddIn work, I had to declare a global variable
for the folders collection to keep the object open. If
Outlook was doing this the right way, then I would not
have to do that.....

.



Sun, 31 Jul 2005 22:19:39 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. using COM/DCOM within a COM-Addin ???

2. unregistering COM AddIn

3. OnAction Property not working in Com Addin (XP)

4. Com Addin - Package & Deployment Wizard

5. how to load and unload an com addin using VBA or VB

6. Outlook COM AddIn Security

7. Com Addin?

8. How can I insert a Controlbutton into an Outlook form using a COM-Addin

9. COM AddIn

10. Retrieving the full path to a COM addin

11. ActiveX Controls in a COM Addin

12. How to convert VBA into a COM addin?

 

 
Powered by phpBB® Forum Software