none
How can I get an event when a CustomTaskPane is closed? RRS feed

Answers

  • Hello,

     

    Here is something that could help you. It is in C#, and developed for Word, but the principle is the same for any Office application that has CTP (I guess):

    ...
    Microsoft.Office.Tools.CustomTaskPane m_Pane = Globals.ThisAddIn.CustomTaskPanes.Add(userControl, Resources.OtherApplicationTitle);
    
    m_Pane.VisibleChanged += new EventHandler(m_Pane_VisibleChanged);
    ...
    
    void m_Pane_VisibleChanged(object sender, EventArgs e)
    {
       var customTaskPane = (sender as Microsoft.Office.Tools.CustomTaskPane);
       if (customTaskPane != null)
       {
          if (!customTaskPane.Visible)
          { 
             //closed
           }
       }
    }
    

     

    Hope it helps,

    Silviu.


    http://www.rosoftlab.net/
    • Marked as answer by DavidThi808 Monday, May 16, 2011 4:33 PM
    Monday, May 16, 2011 2:06 PM

All replies

  • Hello,

     

    Here is something that could help you. It is in C#, and developed for Word, but the principle is the same for any Office application that has CTP (I guess):

    ...
    Microsoft.Office.Tools.CustomTaskPane m_Pane = Globals.ThisAddIn.CustomTaskPanes.Add(userControl, Resources.OtherApplicationTitle);
    
    m_Pane.VisibleChanged += new EventHandler(m_Pane_VisibleChanged);
    ...
    
    void m_Pane_VisibleChanged(object sender, EventArgs e)
    {
       var customTaskPane = (sender as Microsoft.Office.Tools.CustomTaskPane);
       if (customTaskPane != null)
       {
          if (!customTaskPane.Visible)
          { 
             //closed
           }
       }
    }
    

     

    Hope it helps,

    Silviu.


    http://www.rosoftlab.net/
    • Marked as answer by DavidThi808 Monday, May 16, 2011 4:33 PM
    Monday, May 16, 2011 2:06 PM
  • That's exactly what I needed - I was not aware they had events.

    thanks - dave


    The future of B.I. - Raw & Uncut
    Monday, May 16, 2011 4:33 PM