Wednesday, April 14, 2010

Actionspane or simple pane for Excel 2003

Actions pane are not available for programming in Excel 2003 using VSTO for VS 2008.
However, there is a workaround.
Create an office commandbar, Add a user control to it of type activeX.
Make your C# class com visible, create a new GUID and assign the attribute.
make your project COM Visible and also strong named.
The User control in .net containing windows forms controls will be available enabling you to create application level pane similar to actions pane.

The following piece of code is undocumented in MSDN but is a key thing.

objPane = (Office._CommandBarActiveX)actionsPane.Controls.Add(Microsoft.Office.Core.MsoControlType.msoControlActiveX, Missing.Value, Missing.Value, Missing.Value, true);
objPane.ControlCLSID = "";
objPane.Width = 900;
objPane.Height = 337;
objPane.Visible = true;

The key is set CLSID to the object GUID .

No comments:

Post a Comment