Friday, June 8, 2012

VBA: Break All External Links in a Workbook

Here's a tip how to break all external links from a workbook:

Sub BreakAllLinks()

    Dim arrStrLinks As Variant
    ' Read workbook links to an array.
    arrStrLinks = ActiveWorkbook.LinkSources(Type:=xlLinkTypeExcelLinks)
    ' Loop through whole array -> all links.
    For i = 1 To UBound(arrStrLinks)
        ActiveWorkbook.BreakLink _
        Name:=arrStrLinks(i), _
    Next i

End Sub

This is actually a slightly modified version of the one you can find from Excel's help with keyword BreakLinks.

1 comment:

  1. This is my first time visit here. From the tons of comments on your articles,I guess I am not only one having all the enjoyment right here!
    excel vba courses london