Office Add-ins: Any way to have one always running? - ms-office

I have an idea for an Office/PowerPoint Add-in. Most of the ones I've seen (and what is sampled in the documentation) are add-in actions that are triggered by a button click in the ribbon, or triggered by an action the sidebar. However, I need the Add-in to be running from the moment PowerPoint opens.
Is there a way to have a add-in that is running in the background? Listening for events? My idea involves catching when the slide changes - but I need this to happen when the PowerPoint is in Presenter view.
Is this currently possible?

Related

Startup behavior doesn't work in Excel Desktop

I have an OfficeJS Excel Addin which is used in Online Excel and Desktop Excel. I use feature
Office.addin.setStartupBehavior(Office.StartupBehavior.load);
And it work fine for Online Excel: every time I start the excel - the plugin loads in background and ready to use.
However, in Excel Desktop it doesn't work. If I "alert" current behavior (after click on command to run the addin), it says "Load", but anyway it expects user interaction before to start loading the addin.
Any thoughts on this?
Prerequisites: SharedRuntime, Windows 10, Angular based addin
link to doc: https://learn.microsoft.com/en-us/office/dev/add-ins/develop/run-code-on-document-open
You can configure your Office Add-in to load and run code as soon as the document is opened. This is useful if you need to register event handlers, pre-load data for the task pane, synchronize UI, or perform other tasks before the add-in is visible. When your add-in is configured to load on document open, it will run immediately. The Office.initialize event handler will be called. Place your startup code in the Office.initialize or Office.onReady event handler. Read more about that in the Run code in your Office Add-in when the document opens article.

How to automatically show task pane for non-function add-in when opening worksheet?

How can we tell Excel (Web and Desktop) to load but not show an add-in automatically when a workbook is opened? We want code in the add-in to check the worksheet and, if our add-in has been used on it, open the add-in task pane automatically (though we'll give the user an opt-out of the behavior).
(The add-in is just a task pane, not custom functions.)
If you haven't already done that, I would recommed taking a look at the options for running code in your Office add-in when the document opens. From that page:
Configure your add-in to load when the document opens
The following code configures your add-in to load and start running when the document is opened.
Office.addin.setStartupBehavior(Office.StartupBehavior.load);
...
Place startup code in Office.initialize
When your add-in is configured to load on document open, it will run immediately. The Office.initialize event handler will be called. Place your startup code in the Office.initialize or Office.onReady event handler.

Excel web add-in: How to detect ribbon click events?

I am working with the Excel JavaScript API and I am trying to trigger an event when the user clicks on any ribbon button or tab, and get which button or tab was clicked, but I couldn't find a way to do it.
Can anyone help me?
This isn't a supported scenario in Office.js. Your add-in is running in a sandboxed environment (either within an IFRAME or an embedded browser, depending on the platform). Even in cases where the ribbon buttons are part of your add-in, the communication is one-way (clicking the button will trigger loading a page or firing a function from your add-in).

Load an Office add-in or its add-in command by default

I take Excel for example. At the moment, every time when a user wants to use an add-in, they need to go to insert ==> add-ins and choose the add-in. Then either a take pane or content add-in appears. If the manifest xml of the add-in has add-in commands, users can launch the add-in via menu or ribbon.
If the user des-actives the task pane, closes and re-open Excel, they need to go to insert ==> add-ins again and so on... It is tedious.
Is it possible to set an add-in loaded by default (either by developers or users)? For example, each time the user opens Excel, they could see the item in the menu or ribbon (or even the task pane activated) to launch the add-in.
Unfortunately users have to always manually activate the add-in, either from a Ribbon command or from the Add-ins button. Only COM add-ins allow you to display a Task Pane when the Office application opens.
While the ribbon-button feature mentioned by SoftTimur and Eric is one solution to the problem, another potential solution (depending on your business model) may be to use a template:
You can create a .xlsx document and insert your add-in task pane manually, then share that document with others, who will automatically see the open task pane when they open that document. One strategy is to post this template document online and provide links to it elsewhere.

Microsoft Project Application.ProjectAfterClose Event

I'm writing add-ins for Microsoft Project. Some of my toolbar buttons are only valid when a Project file is open, and I want to enable/disable them dynamically. Typically I'd watch for files to be opened or closed, then check the count of the open files. However, MS Project's API only has an Application.ProjectBeforeClose Event, and not a ProjectAfterClose event. The ProjectBeforeClose event fires before the user is prompted to save any changes, at which point they can cancel the close, and no additional event fires.
There's also WindowActivate and WindowDeactivate events, but the Deactivate only fires when switching to a different window, not on close.
Has anyone found an elegant solution to simulate the ProjectAfterClose event? Or more specifically, to enable/disable functionality based on whether or not a project file is open?
Thanks,
Thomas
I had the same problem. A not-so-wonderful approach is to use a timer that checks to see if any projects are open...

Resources