1
votes

We have a custom add-in ribbon that I maintain (that's not a COM shared 'extensibility' add-in) that is using comments and track changes functionality (e.g. there are several buttons related to insert, find, edit and remove), but we recently have had some users that are incorrectly using the "Review" ribbon's comment buttons.

As such, I've been requested to block this when users' have a document loaded through the add-in. At this time, I'm just trying to figure out how to either:

a) handle the Review ribbon's add comment button click event to my existing event handler, or

b) disable the Review ribbon's add comment button

I can't seem to find that either of those are possible except I may be able to "repurpose commands on the Office fluent button", but the methodology described involves creating a new COM add-in-based "extensibility" project; I already have one deployed and don't want to have to go about creating a second one just for this small need. Any ideas?

1
Have you tried with CommandBar controls? Find it by id and than disable itzdrsh
I was trying to use CommandBar Not having much luck... I'm using Globals.ThisAddIn.Application.CommandBars object but what method could I use to find it by id? I know the control name is "ReviewNewComment".CHarmon
Maybe I need to be looking up the commandbar first (e.g. Globals.ThisAddIn.Application.CommandBars("TabReviewWord") but that just throws an ArgumentException "Value does not fall within the expected range".CHarmon
I figured it out... I just had to spend more time using the Watches pane. app.CommandBars("Reviewing") returns the right commandbar, and I'm just for each looping through its controls to get the "Insert Comment" control and then setting .Enabled = FalseCHarmon
That's good to hear. Consider putting it in an answer to this question.zdrsh

1 Answers

0
votes

I figured it out... I just had to spend more time using the Watches pane. app.CommandBars("Reviewing") returns the right commandbar, and I'm just for each looping through its controls to get the "Insert Comment" control and then setting .Enabled = False