+ Reply to Thread
Results 1 to 6 of 6

Update and then break external links to another workbook

  1. #1
    Registered User
    Join Date
    04-23-2014
    Location
    Ukraine
    MS-Off Ver
    Excel 2010
    Posts
    8

    Question Update and then break external links to another workbook

    Hi everyone!

    I am new in VBA, but I have a short procedure to break all external links in the currently active workbook.
    Is there any option to firstly update all external links and only then break them?


    Sub BreakLinks()
    Dim Links As Variant
    Dim i As Integer
    With ActiveWorkbook
    Links = .LinkSources(xlExcelLinks)
    If Not IsEmpty(Links) Then
    For i = 1 To UBound(Links)
    .BreakLink Links(i), xlLinkTypeExcelLinks
    Next i
    End If
    End With
    End Sub


    Thanks for the help in advance!

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Update and then break external links to another workbook

    ActiveWorkbook.UpdateLink Name:=ActiveWorkbook.LinkSources
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Update and then break external links to another workbook

    Try this..

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  4. #4
    Registered User
    Join Date
    04-23-2014
    Location
    Ukraine
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Update and then break external links to another workbook

    Thanks for the help!

    AlphaFrog, i have issue with your procedure...Once i run the macro, it asks me with dialog window to show the location of the file (data to be updated from).
    And same repeated with each link.
    How can i avoid it?

  5. #5
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Update and then break external links to another workbook

    Quote Originally Posted by tatiana_ View Post
    Thanks for the help!

    AlphaFrog, i have issue with your procedure...Once i run the macro, it asks me with dialog window to show the location of the file (data to be updated from).
    And same repeated with each link.
    How can i avoid it?
    I don't follow what you are describing.

    Are you asking that the code is displaying a file dialog and you want to cancel it and exit the procedure? If yes, show that part of your code.

  6. #6
    Registered User
    Join Date
    04-23-2014
    Location
    Ukraine
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Update and then break external links to another workbook

    Thank you, AlphaFrog =)
    the issue is solved...previous file contains a link to a non existing file, thats why it asked to show the location.
    thanks for the help!
    Regards,
    Tanya

+ 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. Possible to have a shared workbook update external data links?
    By scottatbuckman in forum Excel General
    Replies: 1
    Last Post: 03-03-2014, 12:38 AM
  2. Completely remove/delete all the external links (Break Links)
    By SunOffice in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-23-2014, 05:31 AM
  3. [SOLVED] Update external links without opening workbook
    By elliotencore in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-04-2013, 09:45 AM
  4. [SOLVED] External links break after the source workbook is closed
    By jankee in forum Excel General
    Replies: 6
    Last Post: 05-21-2013, 09:14 AM
  5. Links only update when external workbook is open
    By CMB in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-07-2005, 08:45 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