If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Link path change

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-27-10, 14:44
Rodrigo Mota Rodrigo Mota is offline
Registered User
 
Join Date: Dec 2004
Posts: 28
Link path change

Hi, I want to change the path to a file in excel link but I always get an error.
='\\mylocation\folder1\folder2\[file001.001]Sheet1'!$A$1

I want to be able to change the file name and the folder name, I tried to do something like this but I always get an error.

='\\mylocation\folder1\folder' & A1 & '2\[file' & B1 & '.' & B1 & ']Sheet1'!$A$1

I also tried different string manipulations but always get an error or excel won't assume it as a formula.

I even tried to create a function but it also fails if I call it from the worksheet.

Any ideas

Thank you.
Reply With Quote
  #2 (permalink)  
Old 03-27-10, 16:19
Colin Legg Colin Legg is offline
Registered User
 
Join Date: Sep 2008
Location: London, UK
Posts: 477
Hi,
Quote:
want to be able to change the file name and the folder name, I tried to do something like this but I always get an error.

='\\mylocation\folder1\folder' & A1 & '2\[file' & B1 & '.' & B1 & ']Sheet1'!$A$1
Excel considers this to be a string and not a range reference. There's a worksheet function called INDIRECT() which can be used to convert a string to a range reference. Unfortunately there are two drawbacks to using INDIRECT():
  1. It's a volatile function.
  2. If it's pointing at an external workbook which is closed, it returns an error value.
Point 2 is the big factor for your question because you are trying to reference an external workbook.



With INDIRECT() put to one side, your options are either to write (or borrow) some VBA code or to install an add-in which has the required functionality. Some choices are discussed on this thread at Daily Dose Of Excel including:
  • MOREFUNC.XLL which includes the INDIRECT.EXT function
  • Harlan Grove's PULL function
Hope that helps...
__________________
Colin

My Excel articles

Other tutorials:
Array Formulas | Deleting Rows with VBA
Reply With Quote
  #3 (permalink)  
Old 03-27-10, 17:52
Rodrigo Mota Rodrigo Mota is offline
Registered User
 
Join Date: Dec 2004
Posts: 28
Going to take a look to those threads.
Still working to find a way around.
Thank you for your input.
Reply With Quote
Reply

Thread Tools
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

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