Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Relative hyperlinks help

Hi,

I'm using VBA to automatically create links to a number of files using
the following code:

For Each cell In Selection

....

path = "\" + docType + "\" + docFolder + "\" + docYear + "\" + docRef +
"." + extension

If Len(Dir(fullPath)) 0 Then
address = Replace(path, "\", "/")
ActiveSheet.Hyperlinks.Add Anchor:=cell, _
address:="Data/" & address, _
TextToDisplay:="View"

....

where the files are stored in various subdirectories (depending on the
document type) of a folder called 'Data'. The 'Data' folder is in the
same folder as the spreadsheet.

When I run the macro the links, although working, are returned as
absolute links beginning with "File:///C:\....\Data\..." and not the
relative links input within the code. When I move the files to a
different folder with the same structure the links stop working.

I eventually need to put the spreadsheet and files onto a CD and so
need the links to be relative to the spreadsheet's directory.

I've left the hyperlink base path empty in the spreadsheet properties.
How do I go about making the address be forced as being relative in
VBA.

Thanks for any help,
Chris

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
change hyperlinks from relative to absolute Nikki Excel Discussion (Misc queries) 2 April 2nd 23 01:35 PM
Relative Hyperlinks TKS_Mark Excel Discussion (Misc queries) 2 November 20th 08 08:46 PM
Hyperlinks - relative references [email protected] Excel Discussion (Misc queries) 2 October 4th 07 05:32 PM
Relative and absolute hyperlinks Musette New Users to Excel 2 October 4th 07 06:47 AM
Relative Hyperlinks to local files CR Optiker Links and Linking in Excel 3 April 5th 06 06:05 AM


All times are GMT +1. The time now is 08:50 PM.

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

About Us

"It's about Microsoft Excel"