Reputation: 13
My web-app that renders the function file html has a web-filter, hence the file would not render without successful login. Now when I load the add-in, all the buttons come up, but the functions bound to those are not rendered. Clicking on these buttons would say "Excel is working on so & so (button name)" - and that remains forever. Is there a way to catch whats going on there? and, If there are any exceptions, can it be thrown all the way back?
Upvotes: 0
Views: 72
Reputation: 160
"Excel is working on…" appears between the time your function is called and the time the completed()
callback is called on the event your function receives. If you are seeing this notification stick around for too long, then that indicates your function is being called, but either:
event.completed()
when it is finished, orevent.completed()
callback.For functions invoked in this way, F12 Developer Tools will not be of much help. The context in which the function is executed is simply not alive for long enough for it to be attached.
I would recommend one of the following solutions for troubleshooting this:
Implement a task pane with a button that will trigger the function you want to test. Launch that task pane, attach F12 Developer Tools to it, then click the button. Here, you can monitor the Console for uncaught exceptions, add debugger
statements to your code for debugging, etc.
OR… Wrap the content of your function in a try
/catch
block, and in the catch
block, set the value of a cell in the worksheet to the caught error's message.
Option 2 will probably get you what you need more quickly, but Option 1 will set you up for more thorough debugging of other stuff later on.
I hope this helps!
Upvotes: 3