ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hyperlink macro - with filename (https://www.excelbanter.com/excel-programming/422321-hyperlink-macro-filename.html)

xavi garriga

Hyperlink macro - with filename
 
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!
--
atrep

Gary''s Student

Hyperlink macro - with filename
 
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

--
Gary''s Student - gsnu200825


"xavi garriga" wrote:

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



All times are GMT +1. The time now is 11:30 PM.

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