From Thursday, May 23rd (05:00 PM CDT) through Friday, April 24th (1:30 AM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Excel- delete image

I am unable to delete image from excel using the code.

Deleting using rows is not deleting the image.

 

Please help. 

Thank you

0 Kudos
Message 1 of 9
(1,224 Views)

Hi, please save the VI for older versions of LV (e.g. 20) so that everyone can access the file. Go to File --> Save for previous versions and upload it once again.

 

Thanks,

Fort

0 Kudos
Message 2 of 9
(1,213 Views)

2016 Version

0 Kudos
Message 3 of 9
(1,207 Views)
0 Kudos
Message 4 of 9
(1,204 Views)

If the image is not included in any specific cell, it won't be deleted when deleting rows. Could you upload an excel file sample or a screenshot to show exactly what you are trying to achieve?

0 Kudos
Message 5 of 9
(1,193 Views)

I added the image this way.

 

vrbhavz_0-1663670352966.png

 

I want to delete the same once a pdf report is generated.

So the excel is empty for new data.

0 Kudos
Message 6 of 9
(1,167 Views)

Vidya, take a look at this section of the code that you use to delete the contents in the excel file:

afort_0-1663873022124.png

As you already know, this is selecting a range of cells in the worksheet, and then deletes. First let's understand why it is not deleting the image:

In Excel, if you select a range of cells and press 'Delete', it is only deleting the contents in those cells. 

afort_1-1663873715744.png

It will only delete objects if you manually click on them and press 'Delete'. 

Since your "adding image to Excel" code is only adding the image at a certain coordinates and not inside the cell, it will not be deleted with your code.

Thus, you'll exclusively be able to delete objects via LV if you find a way to select objects programmatically. Now, after a bit of research, I have not been able to find any property/invoke node to do that; but I am optimistic that you, or someone else, will.

 

Nonetheless, I am offering you a cheeky workaround so that you can get something running (hopefully!):

Worksheets.png

This VI creates a new empty worksheet and deletes the one you have been working with (considering you only have one). Therefore, it is like deleting the contents of the one you already had.

 

Try it out and reach out as needed,

Fort

0 Kudos
Message 7 of 9
(1,112 Views)

Can you save an empty excel as template for new data instead of deleting images at runtime?

 

George Zou
0 Kudos
Message 8 of 9
(1,107 Views)

can't use xltx?

CY (expired CLAD)
0 Kudos
Message 9 of 9
(1,064 Views)