Destroying ADXTaskPane instances

Add-in Express™ Support Service
That's what is more important than anything else

Destroying ADXTaskPane instances
 
Pavel


Guest


Hello,

I am using an ADXTaskPane.

I have noticed that when I start new excel , each time I open a new workbook, a new instance of an ADXTaskPane is created.

Also each time I close an workbook, an instance of ADXTaskPane is destroyed / disposed.

However there is an exception to the above behavior: If the workbook being closed is the LAST opened workbook, the instance of ADXTaskPane is NOT destroyed.

Q1: Is this "by design behavior" ?
Q2: Is it possible to force the ADXTaskPane instance to be "destroyed" , each time the workbook is being closed ?

BR Pavel
Posted 16 May, 2018 06:27:10 Top
Andrei Smolin


Add-in Express team


Posts: 18829
Joined: 2006-05-11
Hello Pavel,

No, you can't modify this behavior. Could you please explain what you need to achieve and why would you need that pane instance to be destroyed?


Andrei Smolin
Add-in Express Team Leader
Posted 16 May, 2018 09:52:57 Top
Pavel


Guest


Hello Andrei,

What I would like to have is one instance of ADXTaskPane (and all the controls on it) per lifetime of Workbook. My addin is designed to work within context of one Workbook.

Currently I rely on the fact that each time a Workbook is created a new instance of ADXTaskPane is associated to that Workbook via its Window. As well it is same for all the winform controls that I placed on the UserControl on the ADXTaskPane. All those controls are initialized.

However it seems that when I close the LAST opened Workbook, the last instance of the ADXTaskPane is not disposed. And if I then (without closing the whole Excel) subsequently open / create new FIRST workbook, the remaining original instance of the ADXTaskPane is "associated" with the Window of the newly opened workbook and never get through initialization again (since it was already initialized).

I mean it is not big problem, I can think of some workaround here by myself but what I would prefer is that when any workbook is closed, the ADXPTasPane instance of the Workbook window is disposed each time.

What is the reason for this different behavior ?
Can I rely on that that this behaves same way in any Excel version / any situation ?


BR

Pavel
Posted 16 May, 2018 10:28:07 Top
Andrei Smolin


Add-in Express team


Posts: 18829
Joined: 2006-05-11
Hello Pavel,

I see. You can probably control the content of the panes, not the panes themselves. Say, you can associate some UserControl (probably bound to your data) with a pane when the pane is about to be shown; see ADXExcelTasPane.ADXTaskPaneBeforeShow or ADXExcelTasPane.ADXTaskPaneAfterShow event.


Andrei Smolin
Add-in Express Team Leader
Posted 17 May, 2018 05:47:49 Top