We are modernizing our Word VBA add-in to Office.js. We are looking for a way to grab a graphic image and toggle its visibility (which we can reach from the Selection pane). Can this functionality be...
HamnaIshaq
Mar 14, 2025Iron Contributor
Hi Yun_Wang, thank you for your interest. We have 10 logo images layered on top of each other, either in the header or the footer, depending on the document. Only one image is made visible at a time, all other are hidden. In VBA, we are looping through all shapes in the headers/footers and toggling the visibility of the logo image using the property:
For Each Shp In ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Shapes
' … find the desired shape
Shp.Visible = True
Next Shp
- HamnaIshaqDec 04, 2025Iron Contributor
Hi Yun_Wang, I hope you are well. Can you please share updates on grabbing images and toggling their visibility in Office.js? This is crucial for our add-in development, and we look forward to hearing back from you with any updates on progress. Thanks!