Question Programmatically add attachment file to Excel

larrybg

New member
Joined
Jun 29, 2011
Messages
2
Programming Experience
5-10
I’m using Visual Studio 2010 to create application that extracting data from one of our systems to Excel files using Microsoft.Office.Interop.Excel. Some of the items have attachments as text, picture or binary files. How I can programmatically add these attachments to excel file to the certain cell, that I can refer to it later?

Thanks
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,540
Location
Norway
Programming Experience
10+

larrybg

New member
Joined
Jun 29, 2011
Messages
2
Programming Experience
5-10
Thank you JohnH! It worked.
I'm migrating data from one system to another and the only way I can do it is using excel files. Now the importing tool has configuration file where I can map fields from both systems before importing them, including the attachments. How do I know in what cell this attachment is located? I've tried A1 but it didn't work.

Thanks
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,540
Location
Norway
Programming Experience
10+
Look at the properties of OleObject: Properties
TopLeftCell perhaps?
OleObjects aren't linked to cells as such, they float in one way or another according to Placement kind, and are placed and sized in points rather than cell refs.
 
Top Bottom