how to change link source

Andrew XJ

Board Regular
Joined
Feb 21, 2002
Messages
77
This problem prompted to me for a long time.
I have several files which are referenced by one file. My problem is that, after i renamed the referenced files as a new set of files, i need to go to "Edit->Links" to change sources(since the referenced file names and path are changed) one by one.
I have tried to record Macro to change the link sources but it doesn't work. Could anyone help me? Thank in advance.

Here to Learn
XJ
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Detailed Description:
A folder Data-0001 contains file Data-0001-Q1.xls, Data-0001-Q2.xls, Data-0001-Q3.xls, Data-0001-Q4.xls, Data-0001-Summary.xls.
Q1 through Q4 means quarter 1 through quarter 4. These four files are referenced by Data-0001-Summary.xls.
What i need to do is to make another copy of folder Data-0002 and change all "0001" to 0002", but the referenced files by Data-0002-Summary are still Data-0001-Q1,..., so i need to open Data-0001-Summary and go to "Edit->Links" to change all the referenced file name Data-0001-Q1,..., to Data-0002-Q2,...,. This action can be easily done manually. But I need to do this 200 times. That means i need folder from Data-0001 to Data-0200.
How can i use Macro to update the link source?
Thanks!!!

XJ
 
Upvote 0
Hi Andrew,

this does not answer your actual question as what would the macro be, but can you not create a new folder (not copy the existing one with all its contents) then open all 5 workbooks and "save as" with the new filenames into the new folder ?

Links will change automatically if the books are open.

Maybe you can use this as a last resort if nobody can come up with some code for you ?
 
Upvote 0
Thank you!!!Chris. I posted this question a few days ago, but nobody answer it. In fact i feel your idea is still a feasible idea. Thank again.
 
Upvote 0
then open all 5 workbooks and "save as" with the new filenames into the new folder ?

I should have added, save your data files first, not the summary file. Renaming these will update the links in your summary files - you can literally see it happen before your eyes.
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,692
Members
448,979
Latest member
DET4492

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top