Moving Advance Task Pane When Switching Workbooks

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

Moving Advance Task Pane When Switching Workbooks
Moving Advance Task Pane When Switching Workbooks 
mwynn




Posts: 28
Joined: 2015-05-12
I've tried searching the forums, but can't seem to find the answer I'm looking for.
My question is pretty simple, I have an Advanced Task Pane open in an Excel workbook. When I open another workbook, or a new workbook, I want the Advanced Task Pane to move into the active workbook.

What code do I need to make this happen?
Posted 20 Oct, 2019 07:40:15 Top
Andrei Smolin


Add-in Express team


Posts: 16673
Joined: 2006-05-11
Hello,

Each Excel window contains a separate copy of a custom task pane. Consider moving the UserControl located on the pane.

Actually, a pane context is the window in which the pane is embedded. This is sort of ideology or even philosophy of a pane. If you want to have something that works with all windows, the pane isn't really suitable. Consider using a form.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 21 Oct, 2019 03:29:53 Top
mwynn




Posts: 28
Joined: 2015-05-12
Hi Andrei,

Is it possible to get a sample of code that shows how can I move the UserControl into a new taskpane instance?

Thanks,
Matt
Posted 21 Oct, 2019 07:05:33 Top
Andrei Smolin


Add-in Express team


Posts: 16673
Joined: 2006-05-11
Hello Matt,

We don't have such an example. You would need to use the UserControl.Parent property. But I've remembered that this approach may cause you problems if panes are shown in two windows with different DPIs (say on two monitors with different DPIs). To avoid solving these, I suggest that you create a new instance of the UserControl and update it with data from the previous instance.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 21 Oct, 2019 07:17:36 Top