Hyperlink macro - with filename

  • Thread starter Thread starter xavi garriga
  • Start date Start date
X

xavi garriga

Dears;

I'm Trying to do a macro to do an hyperlink and I've done this, but in the
cell appears the path of the file hyperlinked and I would like to know what
should I do to display the filename instead of the path.

Can you help me?

Thanks to all!
 
This little macro will crate a hyperlink in cell B9. Only the filename will
be displayed and the not full filespec:

Sub hyperactive()
Set r = Range("B9")
s1 = """file:///c:\test\Data.xls"""
s2 = """Data.xls"""
MsgBox ("=HYPERLINK(" & s1 & "," & s2 & ")")
r.Formula = "=HYPERLINK(" & s1 & "," & s2 & ")"
End Sub
 
Back
Top