Display only file name in embedded icon

J

Joyce

Hello,

I'm using the code below with a command button to allow users to easily
insert files as icons into an Excel file.

I'd ideally like only the name of the file (as opposed to the entire path)
to be displayed. Is this possible?

Thanks!
 
J

Joyce

Sorry, am living up to being a blonde today! ;-)

Sub InsertFile()


Dim vFile As Variant
vFile = Application.GetOpenFilename("All Files,*.*", Title:=" Find file to
insert")
If LCase(vFile) = "false" Then Exit Sub
ActiveSheet.OLEObjects.Add Filename:=vFile, Link:=True, DisplayAsIcon:=True,
IconFileName:= _
"C:\WINDOWS\Installer\{90110409-6000-11D3-8CFE-0150048383C9}\xlicons.exe", _
IconIndex:=0, IconLabel:=vFile
End Sub
 
Top