Insert image, get name of image

  • Thread starter Thread starter Rick S.
  • Start date Start date
R

Rick S.

Can I insert an image and pass the file name of the image to a varaible?
Using macro recorder doesn't show anything involved with inserting an image.
 
I see that linking displays the file name in the Cell address box. Also
right clicking on the image and selecting "Size and Properties" will give
show the path and file name as one string under tab "Alt Text".
Can I access any of this information via VBE?
 
The recorder will get picture if you use INSERT - Picture. The code below
lets you get a filename and then paste the picture.

filetoopen = Application _
.GetOpenFilename("Picture Files (*.jpg), *.jpg")
If filetoopen <> False Then
MsgBox "Open " & filetoopen
End If

ActiveSheet.Pictures.Insert(filetoopen).Select
 

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

Back
Top