C# interoperability with Excel

C# interoperability with Excel

programmer59
Contributor Contributor
846 Views
2 Replies
Message 1 of 3

C# interoperability with Excel

programmer59
Contributor
Contributor

Hi Everybody,

 

I have the following problem concerning interoperability with Excel.

I was used to use an old version of Excel (2007) until recently.

Concerning the command below :

 

 Microsoft.Office.Interop.Excel.Shape shape=sheet.Shapes.AddPicture(filepath,

Microsoft.Office.Core.MsoTriState.msoFalse,

Microsoft.Office.Core.MsoTriState.msoCTrue,ImageLeft,ImageTop,ImageWidth,Imageheight);

 

It worked very well with this version of Excel (2007)

But I decided to update Excel to 2019 recently, and the command doesn't work any more.

It compiles the program, but when I launch it, I get the error COMException(0x800A03EC)

 

I verfied that the file's path is correct, and it worked with the previsous version of excel.

 

Could someone help me?

 

Best regards

Civil Engineer

0 Likes
Accepted solutions (1)
847 Views
2 Replies
Replies (2)
Message 2 of 3

AGGilliam
Collaborator
Collaborator

I don't see what this has to do with the Revit API. I think the forum in this link will be better suited to answer your question.

0 Likes
Message 3 of 3

programmer59
Contributor
Contributor
Accepted solution

it concerns Revit and the use of Excel if we want to export schedules for example.

 

Since my last post, I found the solution :

 

With Excel 2007, when I wrote a path like that example "C:/Desktop/image.jpg" it worked fine.

But with Excel 2019, it doesn't find the file at this location.

 

So I changed it  with @ and backslash, like this @"C:\Dekstop\image.jpg"

The way of writing the path matters , and it works now.

 

 

0 Likes