Excel and Picture

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
 
R

Rob Bovey

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 *
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top