开发者

Why does my Excel add-in only half work?

I've created an Excel add-in using Visual Studio 2008. It has a ribbon, a bunch of panes and code that adds sheets and ranges and gets information scraped from a web page.

When I run it on my dev PC it works perfectly. I used the Publish command to publich it and installed on a Windows XP virtual PC. The installation seemed fine and when I open Excel I see my ribbon. If I click a button that shows a pane, up pops the pane. If I enter some details into the pane that should create a range and populate it with data from a web page, the range is created but the web page is not visited (I have tested that I have connectivity). One of my buttons adds a hidden worksheet and another displays or h开发者_Python百科ides that sheet. One of these buttons is not working.

I've tried everything I can think of. I'm wondering if there are any permissions or trust issues I need to deal with?


One possible explanation is that an exception is occurring and the execution is halted without warning. In VSTO, to my knowledge, there is no easy way to centralize error handling and at least perform logging of the errors. If the code throwing the exception is not surrounded with a try/catch the exception will just interrupt execution.

So if you haven't done that already, I suggest that you surround all execution entry points like event handlers triggered by user actions (button clicks, etc) with try/catch and log the exceptions.

If you have a lot of these cases you can check the following article (shameless plug) for a possible simplification of this process.

Centralizing VSTO Add-in Exception Management with PostSharp


Sorry, I dont think that I have permission to add a reply to Joao Angelo's post.

Another way that you can find the error messages that are thrown in excel is to add an Environment Variable that will not suppress any error messages that your add-in throws. I encountered this error and was unable to figure out what was causing my add-in to fail.

  1. Select Start -> Right click on My Computer and select Properties.
  2. Select Advanced System Settings -> System Properties dialog should appear.
  3. Select Environment Variables and add a new System Variable.
    Variable name is: VSTO_SUPPRESSDISPLAYALERTS Value is: 0.

Any errors now will be thrown into an excel exception dialog stating the full error message.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜