kcthota

I have created an Add-in for Word and Excel. The Add-in contains a custom task pane which will be launched by the click of a button in ribbon menu. At any point of time in the application, there should be only one instance of custom task pane.

In word I have done the following to check if the pane exists in the current application window.

/*check if window of the pane is the same window of active applicationl;

if not add a new pane; else ignore adding the pane*/

if (RequiredVars.obj_pane.Window != RequiredVars.aAddin.Application.ActiveWindow)

{

RequiredVars.obj_control = new MyControl(RequiredVars.aAddin.Application);

RequiredVars.obj_pane = RequiredVars.aAddin.CustomTaskPanes.Add(RequiredVars.obj_control, "My Pane");

}

The above code is working perfect for Word. But in Excel though there is an open pane in the application, it gets into the condition and adds another pane to it.

Can any one please help me to restrict the pane instances to 1 in a window

Thanks,

Chait




Re: Visual Studio Tools for Office Duplicate Taskpanes in Excel

Ji Zhou C MSFT

Hi Chait,

Why not create the custom task pane in Startup event handle, and use a toggle button on ribbon to control its visible. I think this approach must not resulted in multiple pane instances and makes more sense.

Thanks

Ji