.net – Managed Code AddIn for Access 2003

add-inms-accessnetvb.netvba

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.

Best Answer

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/...)

Related Topic