Programming with embedded Excel

P

Pankaj Dhoolia

Hi,

I have C# addin (to PowerPoint) in which I am programming with embedded
spreadsheets.

On a certain action I add a Worksheet to an embedded Workbook, using
Workbook.Worksheets.Add(...)

Then I select back the first Worksheet using
Worksheet.Select(...)

Everything works fine as long as PowerPoint (with my add-in) is the started
making sure that no Excel application instance is running at that moment.

But if I have a pre-running instance of Excel Application, and then start
PowerPoint (with my add-in), the Worksheet.Select(...) statement above fails
with the following Exception:

System.Runtime.InteropServices.COMException (0x800A03EC): Exception from
HRESULT: 0x800A03EC
at Excel._Worksheet.Select(Object Replace) ...

How do I get rid of this?

cheers!
 
Top