Troubleshooting a COM Addin

If you copy the LNC Renaming.dll file to another computer, install the add-in, and find that you get an error message when running it from its button, open the LNC Renaming.vpb file in VB 6 and make the DLL again; this should fix the problem.

To reopen a COM add-in for editing, double-click the .vbp (VB project) file. You need to have any supporting files (.bas, .dsr, and .frm) in the same folder as the .vpb file, because they are all part of the project.

If your COM add-in isn't behaving as you expect, first unload it (from the COM Add-ins menu), then close Access and reopen a database to see if it now works. This can fix problems that may occur when an old version of the COM add-in code is being run instead of the current version.

If you have a database open with the COM add-in loaded, you will get a "Permission denied" message when trying to make the DLL, because the DLL is being used. Close any open databases and try again, and you should be able to save the modified DLL.

Next, check for duplicates of the DLL file (perhaps backup copies) that might be running instead of the current version of the DLL. In my experience, even DLLs not located in the Addlns folder may be run, so it's best to have only one DLL on your computer for any given add-in (the latest version). Backup copies can be transferred to another computer, to a disc, or zipped, to prevent confusion.

If you find that code referencing Access objects isn't running (with no error message, or an inappropriate error message, such as "No Forms Open" when you have forms open), you may need to add a specific Access application reference to your code. Specifically, whereas COM add-in code in an Access Designer using just Forms to reference the Access Forms collection, or Reports to reference the Reports collection of a database, ran fine in earlier versions of Office, in Office 2007 the Access application variable pappAccess must be used, so the current syntax needs to be pappAccess.Forms instead of just Forms.

If you change the name of a toolbar button created by a COM add-in, you may see the old button on the toolbar, instead of (or in addition to) the new one. To remove the old button, add a line of code to the RemoveAddInCommandBarButton function to remove the button, using the button's old name instead of "Old Control Name":

.Controls("Old Control Name").Delete

Create a new DLL, open an Access database to load the add-in, then unload the add-in from the COM Add-Ins dialog to run the code with the extra line once. Close Access, reopen the VB project, delete the line, and re-create the DLL. That should get rid of the old button.

0 0

Post a comment