954,515 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Positioning an image using Excel

Hi.

I am generating Excel reports for my company using VB.NET programming but have a problem when inserting an image into the spreadsheet and attempting to position it within the sheet.

Please see my code snippet:

'Specify cell range for logo and insert the image
oRng = osheet.Range("A1")
oRng.Cells.Select()

oexcel.ActiveSheet.Pictures.Insert(Application.StartupPath & "\logo.gif").select()

oRng is my Excel.Range object. As you can see, I am trying to select the 1st cell in the spreadsheet to position my picture but instead I just keep getting it positioned where it wants to put it with the empty cell being selected. (Not what I really want)

Is anyone here familiar with Excel programming in VB.NET that could advise me of a solution or point me in the right direction if I'm in the wrong place???

I would REALLY appreciate the help!

mindscape777
Newbie Poster
1 post since May 2008
Reputation Points: 10
Solved Threads: 0
 

you can place pictures like this

xlWorkSheet.Shapes.AddPicture("C:\xl_pic.JPG", _
Microsoft.Office.Core.MsoTriState.msoFalse, _
Microsoft.Office.Core.MsoTriState.msoCTrue, 50, 50, 300, 45)

find more info here :

http://vb.net-informations.com/excel-2007/vb.net_excel_2007_insert_picture.htm

lee_suko
Newbie Poster
2 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You