ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Insert image, get name of image (https://www.excelbanter.com/excel-programming/409415-insert-image-get-name-image.html)

Rick S.

Insert image, get name of image
 
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.
--
Regards

XP Pro
Office 2007


Rick S.

Insert image, get name of 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?
--
Regards

XP Pro
Office 2007



"Rick S." wrote:

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.
--
Regards

XP Pro
Office 2007


joel

Insert image, get name of image
 
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

"Rick S." wrote:

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.
--
Regards

XP Pro
Office 2007


Rick S.

Insert image, get name of image
 
Perfect! Thanks Joel!
--
Regards

XP Pro
Office 2007



"Joel" wrote:

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

"Rick S." wrote:

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.
--
Regards

XP Pro
Office 2007



All times are GMT +1. The time now is 06:41 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com