Error -2146827284 Occurred at Exception in Microsoft Excel: Cannot Access File

Updated Dec 22, 2022

Reported In

Software

  • LabVIEW

Issue Details

 

I have a LabVIEW application that interacts with Microsoft Excel through various ActiveX calls and functions, but when I execute the application I get the following error message: 

Error -2146827284 occurred at Exception occurred in Microsoft Excel: Cannot access <filename.xlsx>. Help Path is xlmain11.chm and context 0 in <filename.xlsx>.

This error code is undefined. Undefined errors might occur for a number of reasons. For example, no one has provided a descriptions for the code, or you might have wired a number that is not an error code to the error code input.

Additionally, undefined error codes might occur because the error relates to a third-party object, such as the operating system or ActiveX. For these third-party errors you might be able to obtain a description of the error by searching the Web error code (-2146827284) or for its hexadecimal representation (0x800A03EC)

Solution

As stated in the error message, this is an ActiveX error and there are multiple potential root causes. 

Some of these root causes have been related to a combination of filenames, folders availability and permissions, so the following troubleshooting steps are suggested:  
  1. Make sure the specified folder exists.
  2. Make sure the folder that contains the file is not read-only
  3. If you are also writing to the file, make sure that the file is not read-only or that its access is not restricted to a group or user in Windows that you are not part of. 
  4. Make sure the file name does not contain any of the following characters: < > ? [ ] : or *
  5. Make sure that the file/path name does not contain more than 218 characters.
  6. In LabVIEW, go to Help > Find Examples > search for "ActiveX". Try running some of the LabVIEW examples that show, all of these interact with Microsoft Excel through ActiveX calls. See if the error persists.  

In case you are getting this error when running an executable, you are using LabVIEW as an ActiveX server, and have an ActiveX client that interfaces with your program from LabVIEW, you'll need to make sure that the executable was enabled to act as an ActiveX server. To solve this :
  1. Open your LabVIEW project
  2. Open the build specifications for your executable
  3. Go to the Advanced tab on the Category section
  4. Click on Enable ActiveX Server checkbox
  5. If you'd  like, give the server name the same name of your application
  6. Rebuild the executable. 



 

Additional Information

As stated in the error message, undefined errors can occur for a number of reasons. For errors related to third-party objects, such as ActiveX, it's valuable and recommended to also search for solutions on different places rather than only at National Instruments. 

If this error persists, please contact our Support to continue helping you.