Addin not working for Office 2010 anymore

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

Addin not working for Office 2010 anymore
... after having used the 2016 PIA's 
Fred Balkenende




Posts: 29
Joined: 2007-07-05
Hi

Sorry, long story...

I have an addin which has to work from Office 2010, and has done for years without any problem. Recently, I changed the references to the Office 2010 PIA's by references to Office 2016, and copied the redistributable PIa's to the 'bin' directory. Just wanted to see if this would help working with the new chart types (sunburst, treemap), but it did not help. So I reverted back to using Office 2010, and changed the references and the assemblies in the 'bin' directory to 2010 PIA's.

Now having to create a new release, I am running into massive problems. First, the appconfig.xml was not automatically created, and the adxlauncher.exe was not automatically entry-point for the ClickOnce installation, so the installation was not working at all. First got this part working again after reinstalling addin-express (yes, using the newest version 8.2.4371). Now the installation still does not work for Office 2010, throwing the following exception:

Exception Message: Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

"Version 15.0.0.0", that off course explains why it is not working for Office 2010. This fails for both the ClickOnce and the WiX installation. The questions is: What is refering to version 15, now that I am refering to version 14 (PIA's 2010)? When I check the installed files, I can see the PIA's of 2010, which also are the one's I refer to in Visual Studio. Where is this "located assembly's manifest"? That file is apparently not updated with the information that we are using the 2010 PIA's now.

Any suggestions?

Thanks
Fred Balkenende
OfficeReports
Posted 13 Oct, 2016 11:41:13 Top
Andrei Smolin


Add-in Express team


Posts: 18791
Joined: 2006-05-11
Hello Fred,

Check the references of your add-in project.

Fred Balkenende writes:
"Version 15.0.0.0"


Office 2016 is supplied with interops for Office 2013. Whence the "15" part.


Andrei Smolin
Add-in Express Team Leader
Posted 13 Oct, 2016 14:04:32 Top
Fred Balkenende




Posts: 29
Joined: 2007-07-05
Hi Andrei

Thanks for your answer. I did notice that. But like a tried to tell, I have changed ALL references back to 2010. That is why I do not understand this "located assembly's manifest" is still referring to Office 2016.

Where is this assembly manifest?

Thanks
Fred
Posted 13 Oct, 2016 14:50:01 Top
Fred Balkenende




Posts: 29
Joined: 2007-07-05
Hi again

I figured it out, problem solved.

I was trying to use the 'ChartData.Activate' method to get the workbook behind 'treemap' and 'sunburst' charts in PowerPoint. This Works in a different way just after the creation of the charts, and it does not work at all after closing and reopening the presentation. Is this because there are no interops for Office 2016 yet? Do you know if they will come?

Thanks
Fred
Posted 14 Oct, 2016 04:26:56 Top
Andrei Smolin


Add-in Express team


Posts: 18791
Joined: 2006-05-11
Hello Fred,

Fred Balkenende writes:
Is this because there are no interops for Office 2016 yet?


I don't think so. Could you please describe the issue in mode details? I will try to reproduce it.


Andrei Smolin
Add-in Express Team Leader
Posted 14 Oct, 2016 10:14:33 Top
Fred Balkenende




Posts: 29
Joined: 2007-07-05
Hi Andrei

Select a chart in PowerPoint, and the use the following code:

PowerPoint.Shape ppShape = ActivePresentation.Windows[1].Selection.ShapeRange[1];
PowerPoint.Chart ppChart = ppShape.Chart
ppChart.ChartData.Activate();
Excel.Workbook xlsWorkbook = (Excel.Workbook)ppChart.ChartData.Workbook;

If you select one of the new chart types (Sunburst, Treemap etc), this code fails, while it works fine with the old types (Column, Bar etc.)

When it works with the old types, 'ChartData.Activate' pops up the wokrbook visually, and then the code continues with the next line. With the new types, the code does popup the workbook, but only if the presentation has not yet been closed. The popup seems to be asynchronous, so trying to get the workbook object using the code above fails anyway. After saving and reopening the presentation, 'ChartData.Activate' does not even popup the workbook anymore.

Thanks
Fred
Posted 16 Oct, 2016 07:27:50 Top
Andrei Smolin


Add-in Express team


Posts: 18791
Joined: 2006-05-11
Hello Fred,

Check https://social.msdn.microsoft.com/Forums/en-US/680ce7dd-a6bc-4156-a47f-48daf6581501/edit-embedded-waterfall-chart-in-powerpoint?forum=exceldev.

Here'a VBA macro I use to debug this issue:

Sub dgsdgsdf()
Dim ppShape As PowerPoint.Shape
Set ppShape = ActivePresentation.Windows.Item(1).Selection.ShapeRange.Item(1)
Dim ppChart As PowerPoint.Chart
Set ppChart = ppShape.Chart
ppChart.ChartData.Activate

Dim xlsWorkbook As Excel.Workbook
Set xlsWorkbook = ppChart.ChartData.Workbook
Stop
End Sub


When using it on a Sunburst chart, I get this error


Run-time error '-2147467259 (80004005)':
Method 'Workbook' of object 'ChartData' failed


While the error message is displayed, PP shows the Excel workbook window. Then I click Debug in the VBA error message, the source code is displayed; In the end I click F5 and the code execution continues (successfully).
I suppose there should be an event indicating (among other things) that the workbook is activated. I expect that this event is the Update event of the CommandBars object; in Add-in Express this event is mapped to the CommandBarsUpdate event of the Excel Events object. That is, you call ChartData.Activate, wait for an CommandBarsUpdate event, in which you find that you may move ahead and invoke the Workbook property. The problem is: I can't invent how to find that moving ahead is possible as I don't see anything on the PowerPoint object model that could relate to this situation. Maybe, you have an idea?

In the very least you can wait for e.g. a second or two before accessing the Workbook property.


Andrei Smolin
Add-in Express Team Leader
Posted 17 Oct, 2016 05:59:36 Top