views:

313

answers:

2

Hi,

I have created a Managed Code AddIn for Access 2003 using Visual Basic 2008 (VS Professional) and it works fine on my development machine. It was created using the Shared Add-in template.

I used the set up project to install... and the .Net Framework was installed.

However when I try to deploy to another PC I get the following error:

Method 'Connect' of object 'COMAddIn' failed

the code that is failing is:

With COMAddIns("MyAddin1.Connect")
    ' Make sure the COM add-in is loaded.
    .Connect = True  'The code crashes here

    .Object.TestAddIn
End With

Article used to create is here (Even though this was written for Access 2007)

The Add-In does exist in the collection but does not connect. Also it does not appear in the list of installed COM ADD-INS through the MS Access 2003 GUI.

I have tried re-installing Office 2003 (complete install) and re-installing the Add-In.

+1  A: 

There are quite a few deployment issues with shared addins. One important one is to deploy the KB908002 fix. Another one is "Office 200x Redistributable Primary Interop Assemblies".

danbystrom
Thanks for the answer. Unless I am mistaken the KB908002 is for Visual Studio 2005 not VS 2008 so not sure if this is still applicable and can't install it on VS 2008 anyway.
Mark3308
I am currently reading articles at http://msdn.microsoft.com/en-us/library/zdc263t0.aspx to try and get it working.
Mark3308
No, KB908002 is needed for 2008 as well. Problem is that you must add it manually as a prerequisity on 2008, but needed it is. Been there, done that... *sigh*
danbystrom
+1  A: 

A few pointers:

KB908002 is required for Office 2003 applications, not for Office 2007 - I believe that there are .net framework hotfixes / SPs that do install this - there is no harm in installing it more than once - it checks to ensure whether has been installed.

Office 2003 Primary Interop Assemblies are required - if you have a setup program you should exclude any office dependencies that it lists there (office.dll, Microsoft.Vbe.Interop.dll etc) and ensure that the PIA is installed

You can put this into the build by adding the PIA into the directory C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\Office2007PIA, along with product.xml so that it appears in the prerequisites section in the setup project. (download these from MS).

The installer should generate a number of registry entries, so does need to be installed on the client, check in HKLM/SOFTWARE/Microsoft/Office/Access/AddIns that your addin is listed (I assume it will be there, Excel Addins are listed under Office/Excel/AddIns (it is at this level, NOT under Office/11.0/...)

GalleySlave
Not sure if you have got this working or not,one other possibility is that your assembly is throwing an exception in your functions for OnConnection or OnStartupComplete - worth ensuring you are catching any exceptions and logging them.
GalleySlave
Installing the KB908002 fix on the client has fixed the issue. Thanks for your help.
Mark3308