Solved

excel links

Posted on 2016-11-11
4
51 Views
Last Modified: 2016-12-01
Hi,

is there any way to update the links in all excel links?

we have new DFS set up and most of the excel sheets have hard links that needs to updated with updated DFS path.

does Excel sheet needs to opened to update links?

I'm looking for a quick and easy solution please if any exists

thanks
0
Comment
Question by:kuzum
  • 3
4 Comments
 
LVL 19

Accepted Solution

by:
crystal (strive4peace) - Microsoft MVP, Access earned 500 total points (awarded by participants)
ID: 41884431
here is a macro you can run to change links.  You will be prompted with the path and filename of each link. You can edit it, paste a new value, or skip it.
Sub ChangeWorkbookLinks()
'161111 strive4peace

   Dim vLinks As Variant
   Dim i As Integer
   Dim sNewLink As String
   
   vLinks = ActiveWorkbook.LinkSources(xlExcelLinks)
   If Not IsEmpty(vLinks) Then
      For i = LBound(vLinks) To UBound(vLinks)
         sNewLink = InputBox("Enter new path\file for link", "Change Link", vLinks(i))
         If sNewLink <> "" And sNewLink <> vLinks(i) Then
            ActiveWorkbook.ChangeLink vLinks(i), sNewLink
         End If
      Next i
   End If
End Sub

Open in new window

0
 

Author Comment

by:kuzum
ID: 41884466
thanks for this.

do I need to use this for each excel and each excel needs to be opened?  OR you run this in one excel against all excel sheets in the directory?

regards
0
 
LVL 19
ID: 41884587
you're welcome
This code would run on each workbook. To make it easier, put it in your personal macro workbook so you can run it whenever you want and on whatever workbook is active.
0
 
LVL 19
ID: 41908424
solution provided by expert
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question