TaskPaneInstance = Nothing in Version 8.01.4350
TaskPaneInstance = Nothing in Version 8.01.4350 after AddInModule.AddinStartupComplete event has fired
|
Glen Griesel
Guest
|
An Excel Task Pane was working fine on Version 8.0.4330.
We have now upgraded to version 8.01.4350.
After the AddInModule.AddinStartupComplete event has fired we attempt to get a reference to MyTaskPaneObject.TaskPaneInstance.
At this point MyTaskPaneObject.TaskPaneInstance Is Nothing under Add-In-Express version 8.01
whereas under Add-In-Express version 8.0 MyTaskPaneObject.TaskPaneInstance returns a valid object reference.
No code change have been made since the upgrade.
Can you please assist with resolving this issue. |
|
Posted 28 Jan, 2016 06:11:44
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 18821
Joined: 2006-05-11
|
Glen,
I suppose the issue relates to our rewriting the core of Add-in Express extensions. You need to modify the code so that it reacts to showing a pane, instead of expecting that a pane will get opened by this or that moment; this would be a correct way to use Add-in Express panes.
Andrei Smolin
Add-in Express Team Leader |
|
Posted 28 Jan, 2016 08:44:04
|
|
Top
|
|
Glen Griesel
Guest
|
Hi Andrei
This code is occurring right in the beginning when we want to add content to TaskPane and in order to do that we need a reference to the MyTaskPaneObject.TaskPaneInstance so that we can add content to it.
I am not sure that I fully understand what you mean when you say
You need to modify the code so that it reacts to showing a pane, instead of expecting that a pane will get opened by this or that moment
1) Could you please provide or point me to some sample code that would accomplish what you have in mind.
2) It sounds like 8.01 had some "breaking changes". If I am correct, is there any documentation on these.
Regards
Glen |
|
Posted 28 Jan, 2016 09:20:16
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 18821
Joined: 2006-05-11
|
Glen Griesel writes:
I am not sure that I fully understand what you mean when you say
You need to modify the code so that it reacts to showing a pane, instead of expecting that a pane will get opened by this or that moment
The pane provides the ADXBeforeTaskPaneShow event. It allows you to modify the pane content before the pane gets shown. In this way you react to pane being shown. In the current version of your code, you expect that the pane is shown when a cetain add-in event occurs.
Andrei Smolin
Add-in Express Team Leader |
|
Posted 29 Jan, 2016 04:43:57
|
|
Top
|
|
Glen Griesel
Guest
|
Hi Andrei
I think I was not explaining myself correctly, let me try again.
The COM Addin in Excel is set to Load On Demand
Right in the beginning we load the COM Addin in Excel VBA (and tell it to add task pane content) as follows:
Set poAddIn = Application.COMAddIns.Item("OurCOMAddIn.AddinModule")
Set poAIObj = poAddIn.Object
poAddIn.Connect = True
' add content to the task pane
poAIObj.AddContentToTaskPane
In the AddinModule we have, inter alia, the AddContentToTaskPane Method as Follows:
Public Class AddinModule
Inherits AddinExpress.MSO.ADXAddinModule
Public Sub AddContentToTaskPane
Dim oTPInstance() As OurTaskPaneClassName
'*> get a reference to the current taskpane instance
oTPInstance = CType(OurTaskPaneClassName.TaskPaneInstance, OurTaskPaneClassName)
' get the task pane to add it's content
oTPInstance.AddContentToTaskPane
EndSub
Our code is failing on the oTPInstance = CType(OurTaskPaneClassName.TaskPaneInstance, OurTaskPaneClassName) line because OurTaskPaneClassName.TaskPaneInstance Is Nothing in 8.01.4350.
In 8.0.4330 OurTaskPaneClassName.TaskPaneInstance is a valid object reference.
Our understanding of things is that in 8.0.4330 and prior, the AddinExpress.XL.ADXExcelTaskpane object gets
created prior to the creation of the AddinExpress.MSO.ADXAddinModule object so that the ADXExcelTaskpane object
is already in existence when the AddinModule references it via OurTaskPaneClassName.TaskPaneInstance property.
Is this still the case because this is where our code is now failing under 8.01.4350 |
|
Posted 29 Jan, 2016 10:58:50
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 18821
Joined: 2006-05-11
|
Hello Glen,
We've found out that the issue "TaskPaneInstance is Nothing in the AddinStartComplete event of a load-on-demand add-in" is caused by a bug in our code. We've fixed it and I've just sent you a download link to the corresponding build; check your Inbox.
Note however that TaskPaneInstance *IS* Nothing in the AddinStartComplete event if your add-in loads normally. For this reason, the generic solution is to intercept ADXTaskPaneBeforeShow event as I suggested above.
Andrei Smolin
Add-in Express Team Leader |
|
Posted 02 Feb, 2016 09:43:36
|
|
Top
|
|
Glen Griesel
Guest
|
Hi Andrei
I have installed the new build 4351 and it has solved this specific problem.
Thanks very much for the help and the new build.
Best Regards
Case closed. |
|
Posted 04 Feb, 2016 14:44:39
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 18821
Joined: 2006-05-11
|
Thank you for confirming!
Andrei Smolin
Add-in Express Team Leader |
|
Posted 05 Feb, 2016 04:09:06
|
|
Top
|
|