How to fix KB00804 – VBA Errors in Microsoft Excel?

Issue:

This KB combines and replaces the information that was found in these other KBs:

  • KB00364 – PI add-ins to Excel not available with various VBA errors after upgrading to Office 2010.
  • KB00267 – Run-time error ‘459’: Object or class does not support the set of events” or “Compile Error in Hidden module: Main” error message appears when opening Excel installed with PI Data Link.
  • KB00526 PI Data Link error: Object library invalid or contains references to object definitions that could not be found.
  • KB00631 PI Data Link Error: “System Error &H80040111 (-2147221231). Class Factory cannot supply requested class.

When using MS Excel with one or more PI add-ins enabled (PI Data Link, PI Tag Configuration, or PI Batch View for Excel), Microsoft Visual Basic for Applications errors are encountered. While opening Ms Excel these errors can be seen or while using functions within add-ins, like the Insert Trend function in PI Data Link.

VBA Errors:

  • Could not load an object because of unavailability on this machine
  • Compile error in hidden module: mod Add in
  • Compile error in hidden module: Main
  • Object library invalid or contains references to object definitions that could not be found
  • Run-time error ‘459’: Object or class does not support the set of events
  • System Error &H80040111 (-2147221231). ClassFactory cannot supply requested class

Solution:

From a variety of issues these errors originate, but they are often related to a malfunctioning MS ActiveX control used by add-in, or by old cached VBA files. The following steps may help to resolve this issue.

Verify required prerequisites and settings

  1. Make sure that the add-ins and related items are installed properly. For example, if the PI SDK is not installed, then that will affect many of the PI add-ins.
  2. Check that the ActiveX controls are enabled (not disabled). In Excel select File> Options> Trust Center> Trust Center Settings> ActiveX Settings. This should NOT be set to ‘Disable all controls without notification’.

Check for cached *.exd files

Search for all files(including hidden file) with the extension *.exd. (By default, Windows does not search for hidden files, so you must change that setting in order to see them). One way to find all *.exd files in a given hard drive is by opening a command prompt, navigating to the root directory of the drive (for example, by first entering “C:” and then “CD \” to get to the root of the C: drive), and then running the following command: dir *.exd /b /a /s
If you find any exd files, reopen Excel by deleting them.

These exd files are created automatically when required, but cleaning is not done automatically and these types of errors may occur, particularly when the runtime files are updated through Microsoft patches.

Relevant software to repair

If you have not already, try repairing the installation of PI Data Link along with the Ms Office or Excel. If a required runtime file or reference is missing, then a repair will simply correct this. Excel Repair Tool being professional software is capable of fixing any errors related to MS Excel. It can easily recover the data in Excel, solve any type of excel corruption error and above all it has easy and consistent user interface.

Try Now       Buy Now
* Free version of the product only previews recoverable data.

Steps to fix this error:

  • Hit on the “OK” button to start the process.user-guide1
  • Select the corrupt .xls or .xlsx file by hitting on “Select file” Choose the “Select folder” to search a .xls or .xlsx file in particular folder. select the “Search file” button to search a .xls or .xlsx file in particular drive.user-guide2
  • Click “Scan” button to begin the scanning process after the selecting the corrupt fileuser-guide3
  • You can see the scanning process is in progressuser-guide4
  • After the scanning is finished, you can preview your corrupt file from right paneluser-guide5
  • Hit on the “repair” button to begin the repair process.user-guide6
  • Select the desired location to save the repaired excel file and after that hit on “OK”.user-guide7

 

Priyanka is a content marketing expert. She writes tech blogs and has expertise in MS Office, Excel, and other tech subjects. Her distinctive art of presenting tech information in the easy-to-understand language is very impressive. When not writing, she loves unplanned travels.