Today I struggled for some time to figure out how to control the visibility of custom task pane in Excel 2007. I had done quite a few Word 2007 addin projects but this is the first time I try to do it in Excel.
In Word 2007 with VSTO 3.0 (that comes with VS2008) to hiding the custom task pane I would add this in the Click event code
Me.Application.TaskPanes(Word.WdTaskPanes.wdTaskPaneDocumentActions).Visible = False
But with Excel 2007 it is different. You have use the DisplayDocumentActionTaskPane class
Me.Application.DisplayDocumentActionTaskPane = False
I found the solution in the MSDN article here.
Just FYI, adding a action pane is same for both application using the following method
Me.ActionsPane.Controls.Add(actions)