COM AddIn for IDE - how to detect host application...

  • Thread starter Heinz-Josef Bomanns
  • Start date
H

Heinz-Josef Bomanns

Hi,

just wondering how to detect the host application where an IDE COM
AddIn is running in. In "OnConnection" i have parameters "Application"
and "AddInInst" - "Application" points to the VBA IDE and "AddinInst"
would be, if i got it right, an object of type "COMAddIn" - so it
should have properties like "Parent" or "Application" which should
give me some informations about the host application. But every try to
read these properties gives me a "method or propertie not supported"
error. Background: I nedd to know if the VBA IDE COM AddIn is running
in Outlook 2000, 2002 or 2003 - Application.Version is always "6"
'cause it points to the VBA IDE. Any ideas? Thanks...
 
K

Ken Slovak - [MVP - Outlook]

Is this a COM addin for the VB IDE or for Outlook? For an Outlook addin you
would get Outlook as the Application in On_Connection even if you are
running in debug mode from the VB IDE. Once you have Application and set an
Outlook.Application object to it you can always read the Version property to
see what you are running under. If Outlook 2000 the left-most digit of the
Version string will be "9", for Outlook 2002 and 2003 you would get "10" or
"11".
 
H

Heinz-Josef Bomanns

Hi Ken,
Is this a COM addin for the VB IDE or for Outlook?

It's a COM-AddIn for the Office VBA IDE with connector set to "Visual
Basic for Application IDE". It hooks into the "Add-Ins" menu in the
VBA IDE...
For an Outlook addin you would get Outlook as the Application in On_Connection

Yeep, that part is working with another COM addin where the connector
is set to "Microsoft Outlook"...

The problem is: When the VBA IDE addin connects to the VBA IDE you
don't get an "Application" object as with other addins. What you get
is a pointer to the VBA IDE, not to the host application in which the
addin is running or in which one has opended the VBA IDE. When
connecting to the VBA IDE the "Application" parameter is of type
"VBE", it has no "Name" property and the "Version" property of this is
always "6" 'cause the application running is "Visual Basic for
Applications Version 6.0" - but i need to know if the VBA IDE was
opend in Outlook 2000, 2002, 2003, Word, Excel, PowerPoint and so
on...

My thoughts were that the "AddInInst" parameter must have a "Parent"
property if it's a "COMAddIn" object - but it is an object of type
"AddIn" that has no "Name", "Parent", "Version" or "Application"
property - even if the help to "VBE" object tells it has a "Parent"
property ;(

Another problem with this addin is displaying forms and MsgBoxs - when
the addin is invoked in the Outlook VBA IDE and i'm doing a
"frmSomething.Show vbModal" it switches back to the Outlook main
window, displays the form in front of Outlook and after closing the
form it switches back to the VBA IDE - if i run the same addin in the
Word VBA IDE the forms and MsgBoxs are displayed correctly within the
VBA IDE window. The connection to the Word VBA IDE occurs when Word is
started, in Outlook the connection is done when you press Alt+F11 -
weired stuff somehow ,-)

Don't spend too much time on this, if there's no solution i'll drop
the project...
 
K

Ken Slovak - [MVP - Outlook]

I haven't done any VBA IDE COM addins, so I can't help much with this at
all. The only thing I can think of to suggest is searching in the KB to see
what articles are there for the VBA IDE and see if they have anything
useful.
 
H

Heinz-Josef Bomanns

Hi Ken,
The only thing I can think of to suggest is searching in the KB to see
what articles are there for the VBA IDE and see if they have anything
useful.

Thanks so far, Ken. I've had a short look already, but nothing that
addresses my problems directly. I'll give it another try later this
year ,-)
 
K

Ken Slovak - [MVP - Outlook]

Try using "IDTExtensibility2" as the search term in the KB, I saw a nice
whitepaper there on Office 2000 development that had some information about
VBA IDE COM addins. It might be helpful.
 
H

Heinz-Josef Bomanns

Hi Ken,
Try using "IDTExtensibility2" as the search term in the KB, I saw a nice
whitepaper there on Office 2000 development that had some information about
VBA IDE COM addins. It might be helpful.

Great tip, thanks - found lots of usefull stuff ,-)
 

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