Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Hyperlinks property return a relative path ...

Hi,

I use Excel 2002 and I have a problem with the Hyperlinks vba property.
I have created some links in my sheet like C:\Folder\test.xls (using
Insert/Hyperlink menu)
When I save my sheet, the link becomes ..\..\..\Folder\test.xls (relative
path)

What I want to do, is to recover the full absolute path using a macro like :

Sub Test()
For Each h In Cells.Hyperlinks
ren = h.Address
MsgBox ren
Next
End Sub

But this macro only give a relative path.
When I move my mouse cursor on the hyperlink, the full path appears in a
comment.
It seems that the absolute path is stored somewhere, bur where ?

Does somebody know how to recover the full absolute path using vba ?
Thanks for your help


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Hyperlinks property return a relative path ...

Maybe something like:

Option Explicit
Sub Test()
Dim hyper As Hyperlink
For Each hyper In ActiveSheet.Hyperlinks
hyper.Address = hyper.TextToDisplay
Next hyper
End Sub

You may be able to avoid this problem by:

File|Properties|Summary Tab|Hyperlink Base
change it to C:\
(something that's always available)

=======
Personally, I try to use the =hyperlink() worksheet function. I think that they
behave much nicer.

=hyperlink("http"//" & a2, "Click me")

or

=hyperlink("file:////" & $a$1 & a2, "Click me")
if $a$1 contained the path: \\server\share\folder\folder\
and a2 contained the name of the file: myFile.doc




Garette wrote:

Hi,

I use Excel 2002 and I have a problem with the Hyperlinks vba property.
I have created some links in my sheet like C:\Folder\test.xls (using
Insert/Hyperlink menu)
When I save my sheet, the link becomes ..\..\..\Folder\test.xls (relative
path)

What I want to do, is to recover the full absolute path using a macro like :

Sub Test()
For Each h In Cells.Hyperlinks
ren = h.Address
MsgBox ren
Next
End Sub

But this macro only give a relative path.
When I move my mouse cursor on the hyperlink, the full path appears in a
comment.
It seems that the absolute path is stored somewhere, bur where ?

Does somebody know how to recover the full absolute path using vba ?
Thanks for your help


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Hyperlinks property return a relative path ...

Hi Dave,

Thanks for your answers.

Concerning the Sub Test, it doesn't Work because the TextToDisplay is
relative too :(

Concerning the Properties solution, it seems to be really a very good
solution !
Instead of C:\ I tried to put a space and it gives the full path from C:\
(when I tried with C:\ the path start after "C:\")

Concerning the Hyperlink worksheet function, I will propose to users to use
it.

Thank you very much
Regards


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Hyperlinks property return a relative path ...

Is there anything that kept the old hyperlink address (maybe when you hovered
over it)? Maybe you can use that property in the sub.

I don't understand the comment about using c:\ and what changed--the properties
screen or the hyperlink URL???

Garette wrote:

Hi Dave,

Thanks for your answers.

Concerning the Sub Test, it doesn't Work because the TextToDisplay is
relative too :(

Concerning the Properties solution, it seems to be really a very good
solution !
Instead of C:\ I tried to put a space and it gives the full path from C:\
(when I tried with C:\ the path start after "C:\")

Concerning the Hyperlink worksheet function, I will propose to users to use
it.

Thank you very much
Regards


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Relative Path to a Folder Heliocracy Excel Discussion (Misc queries) 3 October 3rd 07 04:28 PM
Relative path Perico[_2_] Excel Programming 2 July 4th 07 09:58 PM
how to change absolute path to relative path hwijgerse Excel Worksheet Functions 0 November 25th 05 07:18 AM
Relative path Giovaz Excel Programming 3 July 13th 04 02:21 PM
relative path. Bob Kilmer Excel Programming 0 September 12th 03 12:25 AM


All times are GMT +1. The time now is 11:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"