ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Error closing embedded Excel workbook in PowerPoint (https://www.excelbanter.com/excel-programming/317682-error-closing-embedded-excel-workbook-powerpoint.html)

Gail Hurn

Error closing embedded Excel workbook in PowerPoint
 
I have an embedded Excel workbook in PowerPoint. I would like to save the
workbook but I get an error message.

Here is what the code looks like:

PowerPoint.OLEFormat oleFormat = shape.OLEFormat;
oleFormat.Activate();
Excel.Workbook workbook = (Excel.Workbook)oleFormat.Object;

string fileName = "c\\temp\\text.xls";
workbook.Close(true, fileName, missing);

Is it possible to save the embedded Excel workbook to file? Is so, what's
the best way to do it?

Thanks

AA2e72E

Error closing embedded Excel workbook in PowerPoint
 
I have not done this with Powerpoint but in Word. I can save the embedded
worksheet as follows:

ActiveDocument.InlineShapes(1).OLEFormat.Activate
ActiveDocument.InlineShapes(1).OLEFormat.Object.Sa veAs "c:\xx2.xls"

Note: The index of InLineShapes may vary ( I have only one embedded object).
The embedded Excel object cannot be saved unless it has been ActivateED.

"Gail Hurn" wrote:

I have an embedded Excel workbook in PowerPoint. I would like to save the
workbook but I get an error message.

Here is what the code looks like:

PowerPoint.OLEFormat oleFormat = shape.OLEFormat;
oleFormat.Activate();
Excel.Workbook workbook = (Excel.Workbook)oleFormat.Object;

string fileName = "c\\temp\\text.xls";
workbook.Close(true, fileName, missing);

Is it possible to save the embedded Excel workbook to file? Is so, what's
the best way to do it?

Thanks


Gail Hurn

Error closing embedded Excel workbook in PowerPoint
 
That didn't work in PowerPoint. SaveAs throws an exception.


"AA2e72E" wrote:

I have not done this with Powerpoint but in Word. I can save the embedded
worksheet as follows:

ActiveDocument.InlineShapes(1).OLEFormat.Activate
ActiveDocument.InlineShapes(1).OLEFormat.Object.Sa veAs "c:\xx2.xls"

Note: The index of InLineShapes may vary ( I have only one embedded object).
The embedded Excel object cannot be saved unless it has been ActivateED.

"Gail Hurn" wrote:

I have an embedded Excel workbook in PowerPoint. I would like to save the
workbook but I get an error message.

Here is what the code looks like:

PowerPoint.OLEFormat oleFormat = shape.OLEFormat;
oleFormat.Activate();
Excel.Workbook workbook = (Excel.Workbook)oleFormat.Object;

string fileName = "c\\temp\\text.xls";
workbook.Close(true, fileName, missing);

Is it possible to save the embedded Excel workbook to file? Is so, what's
the best way to do it?

Thanks



All times are GMT +1. The time now is 02:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com