Finding Add-Ins path

G

Gordon G

My Excel COM addin has a help file associated with it. It will be installed, by the installation program, in the same directory as the COM dll is stored. Since the user may choose to store them it wherever he wishes, how can I get my program to find out what directory the COM is stored in(and hence the pathname to my helpfile)
MyApp.Path goves me the path to Excel, but I need the path to the COM.
 
K

Ken Laws [MSFT]

Hi,

Assuming that the COM Add-in is written in Visual Basic, you can retrieve
the ClassID for the add-in within the OnConnection event by using the
AddInInst variable and the code below.

AddInInst.Guid

Now that you have the ClassID, you could use Registry APIs to retrieve the
value of the following key within the registry.

HKEY_CLASSES_ROOT\CLSID\{YourAddinsGuid}\InprocServer32\(Default)

The value of this key contains the path to and name of your COM-Addin dll.

I have included a link below to a Knowledge Base article that has sample
code to read and write registry information using the Registry APIs.

145679 HOWTO: Use the Registry API to Save and Retrieve Setting
http://support.microsoft.com/?id=145679

I hope this helps!

If you have any questions please let me know via the posting.

Regards,

Ken Laws
Microsoft Support


This posting is provided "AS IS" with no warranties, and confers no rights.
 

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