Working with PowerPoint chart data not working anymore

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

Working with PowerPoint chart data not working anymore
New problem after latest MS Office update 
Fred Balkenende




Posts: 29
Joined: 2007-07-05
Hi

Using the latest MS Office 365 Update (version 2003), closing the workbook containing the chart data of a PowerPoint chart fails with error 0x800A03EC. I have also seen this happening in the newest 2016 version. Closing the window instead of the workbook fails as well. Here some simplified code to recreate the issue:

try
{
PowerPoint.Chart ppChart = ppShape.Chart;
PowerPoint.ChartData cdata = ppChart.ChartData;
cdata.Activate();
Excel.Workbook xlsWorkbook = (Excel.Workbook)cdata.Workbook;

// update the chart data

xlsWorkbook.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}

Can you confirm this is a bug in the new update? If yes, where do I report the issue?

Do you have a work-around, so I can close the workbook in some other way?

Thanks in advance!

Regards
Fred
Posted 15 Apr, 2020 04:35:38 Top
Andrei Smolin


Add-in Express team


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

Make sure that "// update the chart data " also includes releasing all COM objects, including the chart. For a test, you can choose to not do the update thus not creating COM objects.

Also, make sure there's no COM add-ins in Excel. If your add-in is laoded in Excel as well, make sure it detects this scenario by checking ExcelApp.UserControl which is false in this case: the add-in may not show the UI and not react to events in this case.


Andrei Smolin
Add-in Express Team Leader
Posted 15 Apr, 2020 04:44:52 Top
Fred Balkenende




Posts: 29
Joined: 2007-07-05
Hello Andrei,

Thank you for the fast reply!

I did test doing nothing (not updating any chart data - no COM object created), and it still fails. I have deactivated my add-in in Excel, which does not help either.

Using Office 365 version 2002 and all older versions are working fine. I (and unfortunately some of my customers as well) only have this issue using the latest update.

Regards
Fred
Posted 15 Apr, 2020 04:52:20 Top
Andrei Smolin


Add-in Express team


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

Please send me a sample project and sample presentation. I'll check the code and test it on my side. Find the support email address in {Add-in Express installation folder}\readme.txt. Make sure your email contains a link to this topic.


Andrei Smolin
Add-in Express Team Leader
Posted 15 Apr, 2020 05:30:45 Top
Fred Balkenende




Posts: 29
Joined: 2007-07-05
Thanks Andrei!

I have sent the requested files, please let me know if you need more.

Regards
Fred
Posted 15 Apr, 2020 06:36:54 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Thank you, Fred.

The code produces this error:

---------------------------

---------------------------
System.Runtime.InteropServices.COMException (0x800A03EC): Exception from HRESULT: 0x800A03EC

   at Microsoft.Office.Interop.Excel._Workbook.Close(Object SaveChanges, Object Filename, Object RouteWorkbook)

   at OpenCloseChart.AddinModule.adxRibbonButton1_OnClick(Object sender, IRibbonControl control, Boolean pressed) in E:_Projects_testsFred Balkenende‚0_04_15 14_33OpenCloseChartAddinModule.cs:line 113
---------------------------
OK   
---------------------------


I believe 0x800A03EC relates to Excel being not focused or never focused. To check this, use two buttons: #1 opens that workbook, #2 closes it. Before clicking #2, click the workbook to activate it. If it works in this scenario, you would need to use the machinery we describe in section Wait a Little; see the PDF file in the folder {Add-in Express}\Docs on your development PC. You should focus the workbook window first: use the Excel object model or Windows API to do this. Once that call is done, you send a message (integer > 1024); then the OnSendMesage fires, you filter out that message and close the workbook.


Andrei Smolin
Add-in Express Team Leader
Posted 15 Apr, 2020 07:28:16 Top
Fred Balkenende




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

Even though it never has been necessary to give the chart data window focus (our solution has been working for many years), I have tried using the 2 buttons. It does not work. After opening, I move the Excel window around, but still get the same error on 'Workbook.Close()' when clicking the second button.

As I see it, the newest version always fails when calling 'workbook.Close()' when trying to close the Excel data window.

Any other suggestions?

Thanks
Fred
Posted 15 Apr, 2020 07:56:36 Top
Andrei Smolin


Add-in Express team


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

This looks like a bug in that Excel version. What Excel build are you using? I can create a post on the Excel for Developers forum to let someone know about the issue.


Andrei Smolin
Add-in Express Team Leader
Posted 16 Apr, 2020 02:10:16 Top
Fred Balkenende




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

It is only happening in the newest versions of Office. I am using the monthly update for Office 365, version 2003 12624.20442. I just updated to version 2003 12624.20466 which was released yesterday. The error is still there.

Thanks!
Fred
Posted 16 Apr, 2020 02:33:55 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Posted 16 Apr, 2020 03:16:15 Top