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

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.




0 Kudos
Message 2 of 9

2016 Version

0 Kudos
Message 3 of 9
0 Kudos
Message 4 of 9

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

I added the image this way.




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

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


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. 


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!):


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,


0 Kudos
Message 7 of 9

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

can't use xltx?

CY (expired CLAD)
0 Kudos
Message 9 of 9