HamnaIshaq's avatar
HamnaIshaq
Iron Contributor
Mar 05, 2025
Status:
New

Working with images in Word

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 added?

3 Comments

  • HamnaIshaq's avatar
    HamnaIshaq
    Iron 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

    • HamnaIshaq's avatar
      HamnaIshaq
      Iron 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!

  • Hi HamnaIshaq , can you share more information of your user scenario here? Do you mean that you want to use API to toggle the visibility of an image? Can you also let me know which VBA API are you using?