#1   Report Post  
J. Freed
 
Posts: n/a
Default editing links

Is there a way to programmatically access links and change them in VBA?
Specifically, we're doing a migration and want to be able to change names of
the links in a spreadsheet from .123 to .xls (converting the source files,
then go back to the destination file and change all the extensions).

TIA.
  #2   Report Post  
Bill Manville
 
Posts: n/a
Default

J. Freed wrote:
Is there a way to programmatically access links and change them in VBA?
Specifically, we're doing a migration and want to be able to change names of
the links in a spreadsheet from .123 to .xls (converting the source files,
then go back to the destination file and change all the extensions).


A macro like this should do it:

Sub ChangeLinksFrom123ToXLS()
Dim vLinks
Dim iLink As Integer
vLinks = ActiveWorkbook.LinkSources(xlExcelLinks)
If IsEmpty(vLinks) Then Exit Sub
For iLink = LBound(vLinks) To UBound(vLinks)
If Right(vLinks(iLink), 3) = "123" Then
ActiveWorkbook.ChangeLink vLinks(iLink), _
Left(vLinks(iLink), Len(vLinks(iLink)) - 3) & "xls", _
xlExcelLinks
End If
Next
End Sub

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - respond to newsgroup

Reply
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
Links to other files Eric Excel Discussion (Misc queries) 1 February 24th 05 10:49 PM
Manually update links Emma Excel Worksheet Functions 0 February 22nd 05 01:23 PM
HELP!!! Missing Links!!! [email protected] New Users to Excel 2 February 16th 05 03:20 PM
Links in formulas change when another user runs a workbook L Mehl Excel Discussion (Misc queries) 2 November 27th 04 09:27 PM
Why do my links break when I burn multiple Excel files to a CD? akrr-rasmussen Excel Worksheet Functions 1 November 17th 04 02:39 AM


All times are GMT +1. The time now is 07:25 AM.

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

About Us

"It's about Microsoft Excel"