find and replace name of links
I came up with a macro that worked. Is there a way that I can
accomplish this without copying the info to a worksheet?
Sub ChangeLinkNamesbyYear()
Dim v
For Each v In ActiveWorkbook.LinkSources
Worksheets("Sheet1").Select
Range("A1").Select
ActiveCell.Value = v
Range("A1").Copy
Range("a2").PasteSpecial
Range("A2").Select
ActiveCell.Replace What:="2007", Replacement:="2008",
LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False,
_
ReplaceFormat:=False
ActiveWorkbook.ChangeLink
Name:=Worksheets("sheet1").Range("a1").Value, _
NewName:=Worksheets("sheet1").Range("a2").Value,
Type:=xlExcelLinks
Next
End Sub
On Jan 30, 3:14 pm, Dave Peterson wrote:
Edit|links|change source
might be the easiest way.
Depending on where those links are, maybe a bunch of edit|replaces would work,
too.
Gerry wrote:
I have several workbooks linked with names similar to this
H:\Budgets\Allcan\AllCan Budget 2007.xls
All I would like to change is 2007 to 2008
Is there a quick and easy way to do this?
TIA
Gerry
--
Dave Peterson
|