Break Links code returns Type Mismatch error

Reddog94

Board Regular
Joined
Dec 20, 2011
Messages
52
This code give me a "Type Mismatch" error, but I can't figure out the issue. Can anyone see what is mismatched? All this is meant to do is to break all links to other workbooks.

Code:
Sub BreakLinks()
 
On Error GoTo ErrorHandler
 
Dim vLinks As Variant
Dim lLink As Long
    vLinks = ActiveWorkbook.LinkSources(Type:=xlLinkTypeExcelLinks)
    If vLinks = vbNullString Then Exit Sub
    
    For lLink = LBound(vLinks) To UBound(vLinks)
        ActiveWorkbook.BreakLink _
            Name:=vLinks(lLink), _
            Type:=xlLinkTypeExcelLinks
    Next lLink
    
ErrorHandler:
    MsgBox Err.Description
    
End Sub
 

Some videos you may like

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Watch MrExcel Video

Forum statistics

Threads
1,099,738
Messages
5,470,448
Members
406,700
Latest member
Mark Rob

This Week's Hot Topics

Top