+ Reply to Thread
Results 1 to 2 of 2

Can only update the last link in the list of links

  1. #1
    Registered User
    Join Date
    06-04-2018
    Location
    Denmark
    MS-Off Ver
    Office 365
    Posts
    2

    Can only update the last link in the list of links

    Hi

    The code passes through all external links that are being changed at the same time. But it is only the last link that changes.
    Why only the last, and not them all?
    Hope I can get help in here (the first time I try it).

    Private Sub cmdExecute_Click()

    Dim wb As Workbook
    Dim ExternalLinks As Variant
    Dim i As Long

    Set wb = ActiveWorkbook

    ExternalLinks = wb.LinkSources(Type:=xlLinkTypeExcelLinks)

    Application.DisplayAlerts = False
    Application.AskToUpdateLinks = False
    If VariantContent(ExternalLinks) = True Then 'Is there links?
    For i = 1 To UBound(ExternalLinks)
    wb.ChangeLink Name:=ExternalLinks(i), _
    NewName:=Replace(LCase(ExternalLinks(i)), LCase(Me.txtOLD.Value), Me.txtNEW.Value), _
    Type:=xlLinkTypeExcelLinks

    Next
    End If
    Application.DisplayAlerts = True
    Application.AskToUpdateLinks = True

    Unload Me

    End Sub

  2. #2
    Registered User
    Join Date
    06-04-2018
    Location
    Denmark
    MS-Off Ver
    Office 365
    Posts
    2

    Re: Can only update the last link in the list of links

    I found the answer myself (and obviously). Can not link to a non-existent file.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA to update links ONLY if the workbook they link to is closed
    By Mattaj247 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-30-2015, 07:33 AM
  2. Replies: 6
    Last Post: 08-14-2014, 10:58 AM
  3. How to link a Word and Excel doc to auto update data and links
    By aimeecrystalaid in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-29-2014, 12:56 AM
  4. Can a button or drop down list link to multiple pivot tables and update them?
    By Gattaca2014 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-14-2014, 12:44 PM
  5. Replies: 0
    Last Post: 12-19-2012, 10:56 AM
  6. List and Update of Excel External Link
    By skorde in forum Excel General
    Replies: 1
    Last Post: 05-04-2009, 02:19 AM
  7. Suppress Update Links dialog AND don't update links
    By Paul Martin in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-02-2006, 08:20 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1