Lỗi failed to set data for loadbehavior trong a tool năm 2024

This text is meant as a troubleshooting guide for users of our Find and Replace add-in for Microsoft Access. However, the problems and solutions described here are universally applicable to any .NET COM-Add-In, not only in Microsoft Access but in all Microsoft Office applications, which support COM Add-Ins (Excel, Word, Outlook, PowerPoint and several others).

Find and Replace is a COM-Add-in developed with .NET C#. COM-Add-Ins are different from add-ins you create with the host application itself, eg. .mda/accda files for Microsoft Access or .xla, or .xlam files for Microsoft Excel. COM-Add-ins are not listed in the applications “Add-In” Ribbon tab (Word/Excel) or the “Database Tools” – “Add-Ins” dropdown (Access). The user interface elements of a COM-Add-in are not automatically put into that specific ribbon tab/drop down. They usually have their own ribbon tab or other custom user interface elements. Find and Replace creates a custom Ribbon tab “AccDevTools” with a group of buttons. If you are missing the user interface elements of an add-in it is a strong indicator that the add-in was not properly loaded.

Options – Add-ins Dialog

In all Microsoft Office applications COM-Add-Ins are listed in the Add-ins tab of the Options dialog. This dialog will also list the “conventional” add-ins (.mda/accda or .xla/.xlam). Please note, Add-Ins for the VBA editor are not listed here. Add-ins for VBA are independent of the host application and are managed in the Add-Ins menu in the VBA environment.

To get to this list, go to “File” in the Ribbon and then to “Options” (lower left corner). In the Options dialog select the tab “Add Ins” on the left.

Lỗi failed to set data for loadbehavior trong a tool năm 2024

This dialog is the place to go to if you want to manage add-ins in your Office application.

Our Find and Replace add-in is named “AccDevTools.AddIn” in that list. This name appears counter intuitive. The reason is, that we built a generic add-in shell that can host different tools to be created in the future.

Usually an add-in should be automatically loaded in the Office host application when it is installed. However, there are a couple of situations where this can go wrong. – The most obvious symptom of these situations is that you do not see the add-ins’ user interface elements (e.g. Ribbon tab) in the host application UI.

Now check in which of the sections of the add-in list the add-in you are dealing with is in.

Active Application Add-ins

If the add-in is listed here, everything should be fine. If this is the case but you still do not see the user interface elements of that add-in, it is a problem specific to that distinct add-in.

Inactive Application Add-ins

In this section are add-ins that are not loaded for a variety of reasons.

The first step you should try if the add-in is listed there, is to select “COM Add-ins” in the “Manage:” drop down at the bottom of the dialog and click “OK”. In the COM Add-ins dialog set the checkmark for the add-in and click “OK”.

Ideally your add-in should load now, be listed in the “Active Application Add-ins” section and the problem is solved. However, this is often not the case.

If the add-in is still not loaded, please open the COM Add-Ins dialog again. Select the add-in in the list of Add-ins and look at the “Load Behavior” line at the bottom of the dialog.

Not loaded. The user selected to disable macros.

If the there is a message saying “Not loaded. The user selected to disable macros.”, go back to the Options dialog, select the “Trust Center” tab and click the “Trust Center Settings” button. There go to the “Add-ins” tab and uncheck all of the options to disable Add-Ins.

Not loaded. A runtime error occurred during the loading of the COM Add-in.

Lỗi failed to set data for loadbehavior trong a tool năm 2024

The message “Not loaded. A runtime error occurred during the loading of the COM Add-in.” can have multiple causes.

Wrong Bitness (32 vs 64bit)

The most common cause for this problem is that you installed the add-in for the wrong bitness of your Microsoft Office installation. If you got 32bit Office installed, you need to install the 32bit edition of the add-in even if your Windows installation is 64bit.

Only if you got Office 64bit, you need the 64bit edition of the add-in.

Even if you are reasonably sure about the bitness of your Office installation, please double check if you experience this problem. The default installation of Office 365 was switched from 32bit to 64bit a couple of months ago.

To check the bitness of your Office installation, start any Office application, go to the “Account” tab in the Backstage (File tab in the Ribbon) and click the “About [Application Name]“ button. The About [Application Name] dialog will show the bitness of your installation.

Lỗi failed to set data for loadbehavior trong a tool năm 2024

If you noticed, you installed the wrong edition, the recommended way to solve this is to uninstall the wrong edition of the add-in and then download and install the correct edition.

Moved or deleted program files

Find and Replace’s program files are installed into the %LOCALAPPDATA%\AccDevTools\FAR directory. If this directory were renamed, moved, or the files deleted, this would cause the above error message.

Of course, if you are having problems with a different add-in, the add-in’s program files will be in a different location. You need to check the documentation of that add-in to find the correct directory.

To solve this either rename / move the file to their original location or go to Control Panel\Programs\Programs and Features to uninstall and then reinstall the add-in.

.NET Framework upgraded

.NET COM Add-ins obviously need the .NET framework to function. The version of the .NET framework the add-in uses is written to the Windows Registry. Usually this is done during the installation of the add-in.

If the .NET Framework has been upgraded on your computer from one major version to another (e.g. 2.0 to 4.0) and the old .NET Framework version was removed after add-in was installed, this would also make the add-in to stop working and trigger the above error message.

Usually, the easiest solution for this case is to uninstall and reinstall the add-in.

However, if there are a lot of configuration settings you don’t want to lose during uninstallation, it may be an option to edit the Windows Registry to change the binding to the .NET Framework version. – If and how this works depends on the add-in. Here only the general gist.

To do that, you need to search the Windows Registry for the name of the add-in. The exact registry path depends on the add-in, but it will match the pattern …\Software\Classes\…\CLSID\…\InprocServer32. In that key change the RuntimeVersion value to match the currently installed version of the .NET Framework. You also need to change the very same value in the version number sub key (1.0.0.0 in the example screenshot).

Lỗi failed to set data for loadbehavior trong a tool năm 2024

You can look up the correct version number in the Windows Explorer in the directory C:\Windows\Microsoft.NET\Framework.

Administrator account with UAC disabled

If you are running Access with an Windows Administrator account and also have User Account Control (UAC) disabled (=”Never notify”) this can also trigger the error message mentioned above.

This is no recommended configuration, neither by Microsoft nor by us! The recommended solution is to use a non-administrator account to log into Windows when working in Microsoft Office and/or set the UAC level to one of the recommended settings, as indicated in the User Account Control Settings dialog.

If you absolutely must work with an administrator account with UAC turned off, you should check the add-in’s installation options. If the add-in has multiple installation options (For the current user only vs. for all users), uninstall the add-in and then reinstall it with the “For all users” option. This should also work in this scenario.

Disabled Application Add-ins

Disabled add-ins usually work, but they have been disabled by the Office host application because automatic crash analysis determined that they were involved in an application crash. This may happen from time to time, even if the add-in was not causing the crash.

To solve the problem, select “Disabled Items” in the “Manage:” drop down at the bottom of the dialog and click “OK”. In the Disabled Items dialog select the add-in and click “Enable” and then close the dialog.

This should solve the problem already, but I recommend that you restart the Office application before you continue to work with the add-in.

Other Causes and Solutions

These are all the causes and solutions I’m currently aware of. There may be more.

If you know about another reproducible scenario of COM add-ins not loading properly and its solution, please leave a comment below describing the problem and the solution or post a link to a descriptive text.