LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error -2147352573 (or 0x80020003 in hex) - ActiveX - Image in Excel

Hello everyone,

I've been experimenting a bit with DirectX, but I've hit a roadblock with an error I don’t quite understand: Error -2147352573 (or 0x80020003 in hex).

My goal is to use DirectX to directly insert an image into Excel. This is meant to be a simple test to explore what ActiveX can do with Excel, so it's intended to be straightforward. However, I feel like I’ve missed something along the way and could really use some guidance.

If anyone has experience with this or has some insight into what could be causing the issue, I'd greatly appreciate your input!

 

Thank you in advance!

0 Kudos
Message 1 of 2
(153 Views)

Hi everyone!

I've recently been dealing with some issues while trying to insert an image into an Excel worksheet using ActiveX in LabVIEW. I managed to solve it on my own, so I wanted to share my solution in case anyone encounters this problem in the future. It's a simple process but requires attention to a few details.

Step-by-Step Solution

  1. Check the Excel Version
    The first thing to know is which version of Excel you're using. In my case, the file was in the Excel 97-2003 format, which caused some compatibility issues. If you're using an older version, try saving the file as .xlsx (Excel 2007 or later) and see if that helps.

  2. Create a Valid File Path
    Make sure that the path to the file or image you want to open actually exists and is correct. Also, remember that when you open a file via ActiveX, you need to close it the same way. Otherwise, the file will remain "locked" and can't be opened directly on your computer while LabVIEW is using it.

  3. Define the File Path and Password
    After defining the file you’re going to use, copy the path into a string in LabVIEW (without quotation marks " " around it). If the worksheet has a password, enter it in the corresponding field.

  4. Select the Worksheet and Use "Variant to Data"
    In the worksheet index, select the one you want to work with. Then, use the "Variant to Data" function to convert the data to the correct format. This step was essential for me, as it allowed me to set the path correctly to insert the image.

  5. Add the Image
    Now, add the AddPicture function to your VI and configure the parameters (I recommend setting each size parameter to 100 as an initial setting to help position it).

  6. Save and Close
    Finally, use the SaveAs command to save the file and the Quit command to close Excel properly.

Notes

  • Warning: Always test this process on a copy of your file to avoid issues.
  • Size Settings: The 100x100 size is just a suggested starting point; adjust as needed for your layout.

I hope this helps! Here’s the VI I used as an example.

0 Kudos
Message 2 of 2
(115 Views)