Worksheet Activate event is not firing

February 12, 2013

On a fine day, I found that custom task pane is not appearing on activating a worksheet. I could find no error messages in our log4net log and windows logs. I tried to troubleshoot for a while but nothing worked. 

Finally, I went back my stable project and started comparing the code. It's found that the following line was commented out. 

                 Globals.Factory.GetVstoObject(projectPlanSheet);

As soon as I have removed the comments and task pane showed up again. 
I found that GetVstoObject() generates an extended object which gives access to application level events. Also, check out HasVstoObject().  

A short description about extended object

  • Add managed controls to any open document or worksheet
  • Convert an existing list object on an Excel worksheet to an extended ListObject that exposes events and can be bound to data by using the Windows Forms data binding model
  • Access application-level events that are exposed by Word and Excel for specific documents, workbooks, and worksheets


References:
  1. Getting Extended Objects from Native Office Objects in Document-Level Customizations
  2. Extending Word Documents and Excel Workbooks in Application-Level Add-ins at Run Time
  3. Using Activate event on an Excel Worksheet

You Might Also Like

0 comments

Popular Posts

Twitter