0
votes

I'm newbie with VSTO and having trouble getting my project started. I have an add-in for Word 2016 in VS 2017. When I open a docx file directly from windows file explorer, the ribbon tab appears and the button functions as it's supposed to. But if I open Word, then open a document, or create a fresh one in Word, or open Word by clicking 'start' in Visual Studio, my tab does not appear on the ribbon. I have tried adding my dll in manage COM Add-ins and it says "is not a valid Office Add-in", even though it otherwise works. The LoadBehavior in the registry is set to '3', meaning it should load automatically. This value stays regardless of whether the tab appeared or not. Any help would be hugemongously appreciated.

2

2 Answers

0
votes

Most probably you get an error at runtime and Office hides your customizations automatically.

By default, if a VSTO Add-in attempts to manipulate the Microsoft Office user interface (UI) and fails, no error message is displayed. However, you can configure Microsoft Office applications to display messages for errors that relate to the UI. You can use these messages to help determine why a custom ribbon does not appear, or why a ribbon appears but no controls appear.

To show VSTO Add-in user interface errors

  1. Start the application.
  2. Click the File tab.
  3. Click Options.
  4. In the categories pane, click Advanced.
  5. In the details pane, select Show VSTO Add-in user interface errors, and then click OK.

For Outlook, the Show VSTO Add-in user interface errors checkbox is located in the Developer section of the details pane. For other applications, the checkbox is located in the General section of the details pane.

0
votes

Finally solved it: project properties > debug tab: turned on "start external program" and entered the exe of the version I wanted. I found that out through the task manager, right-clicking program and clicking "open file location".