Example Code

Error -2147352571 When Reading Excel Data in LabVIEW Using ActiveX

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Description

This example covers how you can fix error -2147352571 from the Variant To Data Function in LabVIEW when reading cells which include an error such as #DIV/0. The example is applicable when you are reading data from a Microsoft Excel sheet using ActiveX.

How to Use

Error -2147352571 can be caused by a data type mismatch. Please try to change the data type that you connect to the type terminal of the Variant To Data Function.

An example program is attached below. If you try to convert variant data read from Excel cells which include error #DIV/0 into a string array, error -2147352571 will occur. But, if you try to convert the variant data into a numeric array, you can avoid the error.

Related Links

Using ActiveX with LabVIEW - LabVIEW Help

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.