My goal is to simply offer my addin if Office application is launched with a certain argument.
Unfortunately, I could not find anything to help me do this. I have tried to use the Office Application Load Addin swtich /lc:Addin.dll
with no success. One option I entertained was to create all of the Office addin registry entries upon time of wish to launch addin however this seemed extremely clumsy and way to much overhead. Also, the deal breaker for me was requiring registry creation elevated privileges in order to initialize the addin.
I decided to have my addin not do much of anything at startup unless a certain environment variable exists.
In order to do it this way I need to either set the ribbon to non-visible by default and show the Ribbon upon discovering the env variable. Or the opposite have the ribbon visible by default and hide the ribbon upon discovering env variable.
Things I have tried
- Setting ribbon's tab
Globals.Ribbons.MyRibbon.MyTab.visible = false
. - Invalidating the Ribbon
Globals.Ribbons.MyRibbon.RibbbonUi.Invalidate()
. - Invalidating the tab after setting visible to false
Globals.Ribbons.MyRibbon.RibbbonUi.InvalidateControl(tabCtrlId)
.
The things tried dont include the dozens of thing to try to only load addin in certain circumstances.