Patrick\’s Bytes

19, February 2008

Hiding Task Pane programmatically with VSTO

Filed under: Excel,Visual Studio,VSTO — patrickyong @ 7:36 am

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)

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: