In my last post, I was able to find out how to add a picture to an Excel document from VB.NET.

VB Code:
  1. Dim pic As String = "filelocation/exactfilename.jpg"
  2. oSheet.Range("B1:B1").Select() 'Where you want picture top left corner to be
  3. oXL.ActiveSheet.Pictures.Insert(pic)

What if I have multiple Excel doc's I am creating and the picture needs to be a different size on each one?

In VB6, I did it this way - which does not work so well in .NET.


VB Code:
  1. objexcel.ActiveSheet.Pictures.Insert(App.Path & logotext).Select
  2. objexcel.Selection.ShapeRange.ScaleWidth 0.15, msoFalse, msoScaleFromTopLeft
  3. objexcel.Selection.ShapeRange.ScaleHeight 0.15, msoFalse, msoScaleFromTopLeft

I am having a lot of trouble understanding how Excel works with the newer .NET language. Slowly buy surely I am figuring this out... with the help of everyone on VB Forums.

Thank you in advance for your time and assistance.