casgage
casgage

Reputation: 529

Deploying MS Word VSTO addin written in C#

I have been using VBA in Word for years, I have dozens of useful functions linked to keyboard shortcuts and a Ribbon extension, and I understand the Word Object model fairly well.

I am now trying to switch to VSTO and C# and Visual Studio. I am not worried about converting my VBA code but I can't find any help on how to deploy my VSTO/C# code, i.e. how to invoke a particular function from a keyboard shortcut, and how to link it to a custom Ribbon entry.

Google has not shown me anything about this, and Microsoft's web site probably has it but I can't find it.

Can anyone give me a pointer?

Upvotes: 1

Views: 132

Answers (1)

Chris
Chris

Reputation: 3529

You could do both of those things with a custom ribbon. Y would set onAction and keytip. You'd end up with something like this:

// in your ribbon's xml
<ribbon>
  <tabs>
    <tab ...>
      <group ...>
        <button id="YourCustomId" onAction="YourCustomAction_Click" keytip="H" ... />
      </group>
    </tab>
  </tabs>
</ribbon>

// in your ribbon's code file
public void YourCustomAction_Click(IRibbonControl control) { ... }

If you mean setting a key combo like when you Customize the Ribbon... and then Customize... the keyboard shortcuts, I'm not sure.

Upvotes: 1

Related Questions