Break Links to another workbook

May 1st, 2007

Sometimes, you get a workbook with links to many other workbooks that you don't need or don't have. It's easy to break the links through the user interface (Edit->Links) but if there's a lot of links you need to break, it can be annoying. Specially if you have to do it over and over again. So here's a short procedure to break all external links in the currently active workbook.

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

Posted in Excel, How To, VBA | 5 Comments




5 Comments »

RSS feed for comments on this post. TrackBack URI

  1. Finally……some who post code that actually works.

    Great stuff mate works like a charm. Had to wade through a 1000 other sites with code that doesn’t work before I found yours.

    Cheers
    K

    Comment by Kumungi — December 9, 2008 #

  2. You’re welcome Kumungi. I’m glad to hear that I was able to help.. Thanks for stopping by and leaving a comment!

    Comment by Vergel — December 9, 2008 #

  3. Vergel,

    Excellent! What a time saver. Using the user interface did not always break all the links. Your VBA works perfectly.

    Good job!

    Comment by Casey — April 16, 2009 #

  4. Thank you very much for your effort.

    Comment by FTPete — June 18, 2009 #

  5. took one link away, but left other UNKNOWN links still there.. this links stuff is sos rediculas .. brain pain

    Comment by mike — March 8, 2010 #

Leave a comment



(C) by Virgilio Adriano. All rights reserved. Powered by WordPress.
Entries and comments feeds.
It took 0.707 seconds to load this page.