how to insert the path of an image rather than the actual image itself (in excel 2010)

lrussell5

New Member
Joined
Aug 19, 2013
Messages
11
I need to find an easy way to locate an image on my server and upon selection rather than inserting the actual image I need to insert the image path. e.g. "s:\images\highres\green\1234.jpg"

Any ideas would be very much appreciated!
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Umm VBA code?

Code:
Sub RetrieveFileName()

Dim sFileName As String
 


    sFileName = Application.GetOpenFilename


    If sFileName = "False" Then Exit Sub


    Range("B4") = sFileName
        


End Sub

You can even add a nifty button into the sheet and just link it to this macro. Should just display the file name ("B4") can be changed to wherever you want it displayed.
 
Upvote 0
Thanks allot Slizer that is just what I was after, any idea how I can copy the button / code so that i can paste it down the sheet?
 
Upvote 0
Umm lets make this easier on you

Change Range("B4") = sFileName to ActiveCell.Value = sFilename

This will make the current cell be what has the filename added.

Next lets create a short-cut I am going to use Ctrl+W

Go to developed tab, click macros, click our new macro, options, set shortcut to Ctrl+W
 
Upvote 0

Forum statistics

Threads
1,223,713
Messages
6,174,043
Members
452,542
Latest member
Bricklin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top