COM Add-In load problem

N

Niranjan

Dear All,

I have developed Add-Ins for Office 2003 Word, Excel and Visio with C#. I am
using Install Shield (not the default setup project) for installing the
Addins along with the main application. On some machines the addins fail to
load. I have checked registry, GAC everything but the problem persists.

Also when the host application is openend and Help->about menu->disabled
items are checked, the addin is listed there. Is there any way to find out
as to why the host application is disabling the addin ?

Is it anything to do with the versioning of the addin dlls ?

Any help highly appreciated.

Thanks and regards,

Niranjan Marthe
 
K

Ken Slovak

Typically an addin makes it to the disabled items list by either not
handling all possible errors (even with an On Error Resume Next handler) or
by taking some action that a script stopper objects to. The most common of
those actions is using CreateObject or GetObject on an Outlook or Word
Application object. You should be deriving all your lower level objects as
derivatives of the Application object that is passed in the On_Connection
event.
 
N

Niranjan

Ken,

Thanks for your reply. I got rid of the problem, by enabling the Addin from
the host and then again re-installing it. It works fine. But just for future
reference can you point out what's wrong with the following code?

try {
applicationObject = application;
addInInstance = addInInst;
if (application is Visio.Application)
{
tcrVisio = new TcRVisio2k3();
tcrVisio.setApplication((Visio.Application) application);

// set the COM addin object
Office.COMAddIn addin = (Office.COMAddIn) addInInstance;
addin.Object = tcrVisio;
// setup culture and resources

string culture = getCultureFromRegistry();

TcRResourceManager tcrResource =
TcRResourceManager.getInstance(culture);

resource = tcrResource.getResource();

// init log file

OfficeHWND visWnd = new OfficeHWND("VISMAIN", ((Visio.Application)
application).Name);

TcRLogger.getInstance().setOwner(visWnd);

TcRLogger.getInstance().cleanLog();

}

else

{

// We should not hit this code.

MessageBox.Show(resource.GetString("HostNotVisio03")
+Environment.NewLine +resource.GetString("AddinNotLoaded"));

}

}

catch (Exception e)

{

// Log error into logger

}

Thanks and Regards,

Niranjan Marathe
 

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