LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Old July 7th 06, 03:07 PM posted to microsoft.public.excel.links
Posts: n/a
Default Problems saving a worksheet with links

Does anyone know how I can resolve this issue ... I have a directory which
contains 129 worksheets which have links to external data (in a Master
Spreadsheet) -- I need to copy these files into a New Directory, but kee the
Master Spreadsheet (which they are linked to) in the original location. If
I do a simple Cut & Past, the Reference Link to the Master Spreadsheet gets
moved to the New Directory (where the file does not exist), but if I open
the worksheet (in the original directory/location) and Save As to the New
Directory, the worksheet saved in the New Directory maintains its link to
the Master Spreadsheet in the original directory/location. I hope I've
explained this clearly.

Here's my problem -- it's a bit time consuming to have to open each and
every worksheet and Save As to the New Location -- I'm not sure if a Batch
File (or Dos Command xcopy) would solve this -- Is there some code I could
use to Open each worksheet, Save As to the New directory, Close, then
perform this on each of the .xls files in the original directory? If so,
could you please point me in the direction with an example of the code.


Files in C:\Temp (a.xls, b.xls, c.xls) Copied to C:\Budget

Many Thanks in Advance.

  #2   Report Post  
Old July 9th 06, 12:25 AM posted to microsoft.public.excel.links
external usenet poster
First recorded activity by ExcelBanter: Jul 2006
Posts: 473
Default Problems saving a worksheet with links

You could adapt the code posted in the other thread to ChangeLink
rather than UpdateLink

So, instead of
Sub UpdateActiveWorkbookLinks()

make it
Sub ChangeMasterWorkbookLink()
Dim vLinkSources
Dim iLinkSource As Integer
Dim AnySheet As Worksheet
For Each AnySheet In ActiveWorkbook.Worksheets
vLinkSources = ActiveWorkbook.LinkSources(xlExcelLinks)
If Not IsEmpty(vLinkSources) Then
For iLinkSource = LBound(vLinkSources) To UBound(vLinkSources)
If Instr(LCase(vLinkSources(iLinkSource), "master.xls")0 Then
ActiveWorkbook.ChangeLink vLinkSources(iLinkSource), _
"\\Server\MyDir\mySubDir\master.xls" , xlExcelLinks
End If
End If
For Each AnySheet In ActiveWorkbook.Worksheets
End Sub

and call it from the code that loops through all xls files in a
Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - respond to newsgroup

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
History worksheet - can it remain viewable after saving? plngarbage Excel Worksheet Functions 0 May 16th 06 03:11 AM
Edit Links: Changing links on a protected worksheet Halibut68 Excel Discussion (Misc queries) 0 April 28th 06 11:03 AM
Updating links from one worksheet to another worksheet Eileen Excel Worksheet Functions 1 April 19th 06 01:07 PM
saving atable of links into spreadsheet orthomedus Excel Discussion (Misc queries) 0 April 6th 06 05:32 PM
worksheet links BAC Excel Worksheet Functions 0 March 22nd 06 03:54 AM

All times are GMT +1. The time now is 10:22 PM.

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

About Us

"It's about Microsoft Excel"


Copyright © 2017