Search code examples
javascriptoffice-jsoffice-addinsword-addins

How to hide open window while executing a command?


For a word javascript add in, an empty window "Window of developer" opens when the user is clicking on the ribbon button to execute the command. It remains open after the completion of the command (event.completed()).

window of developper

It is based on the sample of office add in commands: https://github.com/OfficeDev/Office-Add-in-samples/tree/main/Samples/office-add-in-commands/word

Is it possible to:

  1. not open the windows but execute the command ?
  2. or close it directly after but execute the command ?
  3. or close it after the command is completed ? (window.close() seems not working)

Solution

  • This is the developer window that only appears when in developer mode when add-in has no UI on Mac, and can be used used to attach debugger to an add-in through right click + inspect. https://learn.microsoft.com/en-us/office/dev/add-ins/testing/debug-office-add-ins-on-ipad-and-mac has more details. Developer mode has to be manually turned on, but to disable it so that you don't have the popup you can run the command "defaults delete com.microsoft.Word OfficeWebAddinDeveloperExtras" in terminal and restart Word. Some of the VS code templates for developing add-in may also set this key for you if you didn't manually enable developer mode through terminal.