VSTO - How to disable Word ribbon buttons when user selects a modern comment

Rhys Wakeham 31 Reputation points
2024-07-16T08:21:34.89+00:00

Hi,

Details:

VSTO addin for Word

Word version: 2405 (Build 17628.20188 Click-to-Run)

Problem:

In our VSTO addin, when a user is focussing a modern comment, we'd like to disable certain ribbon buttons.

This is because some of our features don't work when a modern comment is focused.

Word has this behaviour with their own ribbons. In the 'Home' ribbon, Word disables the font type, font size and Styles sections of the ribbon in this scenario.

Is there a way my Word C# VSTO Addin can replicate this behaviour?

What I've tried:

  • Reading the Microsoft.Office.Interop.Word.Comments and Microsoft.Office.Interop.Word.Comment classes & docs. I see nothing related to user focus / events
  • Checking the Microsoft.Office.Interop.Word.TrackRevisions flag. This throws an exception in this scenario but feels quite hack-y

Many thanks,

Rhys

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,715 questions
0 comments No comments
{count} votes