Search code examples
exceleventsoffice-jsexcel-addinsexcel-web-addins

Trigger Office JS event when clicking on an image within Excel


I am trying to trigger code to run on the click of an image within Excel using Office JS.

So far I am giving the image a name in the Name Manager and then I'm using the onWorksheetCollectionSelectionChange() event handler to look for that name.

The name is found when I select any cell or range, but when I select the image itself, the onWorksheetCollectionSelectionChange() method is not called. It doesn't seem like an image can be included within a cell and share its properties, or can it?

Is there a way to achieve this without using VBA?

Thanks!


Solution

  • Could you try listening Excel.Shape.onActivated on the image and see if it works for you?