Hyperlink macro - with filename

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!
 
G

Gary''s Student

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
 

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

Top