Excel and Picture

  • Thread starter Thread starter Yaron
  • Start date Start date
Y

Yaron

Hi,

I want to have the option to get a picture on my excel
sheet.

I want to put the data , let say in Ceel A1
(exampel: YR255) and excel will go and find the file
(YR255.jpg) and will display it on A2

How do i do it , please help
 
Hi Yaron,

Here's one way to do it:

Sub InsertPicture()
Dim objPict As Picture
Dim szName As String
szName = Sheet1.Range("A1").Value
Set objPict = Sheet1.Pictures.Insert("E:\" & szName)
objPict.Top = Sheet1.Range("A2").Top
objPict.Left = Sheet1.Range("A2").Left
End Sub

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *
 
Back
Top