Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > PC based Database Applications > Microsoft Excel > Using relative links ?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-24-08, 17:23
ontheDB ontheDB is offline
Registered User
 
Join Date: Sep 2003
Posts: 73
Using relative links ?

I've searched and been unable to find a solution to this:

is there a way to use relative links in an Excel cell ?

For example, if the cell currently refers to:

='\\Z:\directory\[workbook.xlsx]worksheet'!$F$3

is there a way to use:

='\[Workbook.xlsx]worksheet'!$F$3

(assuming the all workbooks are in the same directory)


thanks!
Reply With Quote
  #2 (permalink)  
Old 06-24-08, 21:44
savbill savbill is offline
Registered User
 
Join Date: Feb 2004
Posts: 525
There is not a way that I know of unless you use VB to control the links. If the linked files have moved since the links were created you'll get an alert with an option to Edit Links. You can check the links and edit them by selecting "Edit->Links..." this opens a window where you can change the location of the external links contained in the workbook.

I try not to use external links for the reason it creates more overhead to maintain them and makes the "update links" warning display when the workbook is opened.
__________________
~

Bill
Reply With Quote
  #3 (permalink)  
Old 06-25-08, 12:54
ontheDB ontheDB is offline
Registered User
 
Join Date: Sep 2003
Posts: 73
Thanks for the reply. Guess it'll explain why I couldn't find a solution here or on the internet.

So would the VBA psuedo-code would go something like:

Start
Use some function to get current directory.
Manually update each cell with the new current working directory.
End.


Thanks,
Reply With Quote
  #4 (permalink)  
Old 06-25-08, 23:04
savbill savbill is offline
Registered User
 
Join Date: Feb 2004
Posts: 525
There's a few different ways of approching this using VB depending on what you want to do. I like to keep the code seperate from the data so write to minipulate data on the ActiveWorkbook or have the code open and act on a defined workbook. So you can refer to an absolute defined path or use reserved statements for example: ActiveWorkbook.Path, ThisWorkbook.Path ThisWorkbook would give you the path from the file the script is running in. Active Workbook whatever path the active workbook exists in. I wouldn't define outside links using VB as that just replicates the problem your having in the first place. You could have VB check a file in a specifide location and pull data into your workbook from that file. An update query or process. And you can use a Function to derive a path. I often use a function to obtain the path N folders up from the working file directory. This way I can develop on say a local directory with the same folder structure as the Server location. Then once I deploy the program it is not necessary to set or change any paths in the code.


Quote:
Originally Posted by ontheDB
Thanks for the reply. Guess it'll explain why I couldn't find a solution here or on the internet.

So would the VBA psuedo-code would go something like:

Start
Use some function to get current directory.
Manually update each cell with the new current working directory.
End.


Thanks,
__________________
~

Bill
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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