0
votes

I am developing an Excel VSTO C# add-in. The add-in has a single command-bar ribbon with 1 command-bar-button.

the purpose of this button is to

  1. open a dialog window that allows search dates to be entered
  2. then calls off to a web-service to retrieve data, which gets populated in the spreadsheet.

The problem is that after the install of the add-in it all works as expected. however after shutting down excel, then reopening it later, the click event on the command-bar-button is no longer handled or is not firing.

The VSTO addin is installed from a network location.

1
I noted your usage of "command-bar-button"; does this mean you are not using a standard ribbon? Are you adding a button to the menu bar, which ends up showing in the Ribbon in Office 2007?Mathias
@Mathias I am adding a button to toolbar that ends up on the ribbon.Nathan Fisher
I never had problems with menus, I'll look into buttons. Any reason why you are not using the Ribbon controls? Is this because you have to support Excel 2003?Mathias
It is a 2003 spreadsheet (that must stay in 2003 because of the recipient), but opened in Excel 2007. All the examples that I looked at talked about the commandbarbutton. perhaps I was looking in the wrong places. I will investigate the Ribbon controls. to see if that makes any difference.Nathan Fisher
If you want to support 2003, I think you have to follow the approach you describe with a control. I was just checking because your tags mentioned 2007 and not 2003.Mathias

1 Answers

1
votes

If your add-in targets Excel 2007, and doesn't require to be installed on Excel 2003, there is no reason to use CommandBar buttons - use the Ribbon. It will make your development easier, and will look better, too. If you already use Excel 2007 to open and work with the Excel 2003 document and this hasn't caused problems, doing the same via VSTO should not introduce problems.

There are plenty of tutorials on how to use the Ribbon; I have one post on my blog showing how to add a button to the Ribbon to trigger some action: http://www.clear-lines.com/blog/post/create-excel-2007-vsto-add-in-ribbon.aspx