Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Break Links not working

Status
Not open for further replies.

Ebes1099

Technical User
Jul 8, 2009
156
US
I've used this code in the past on a workbook and I can't figure out why it's not working now. I can't even break the links by selecting the "Edit Links" button in the Ribbon and clicking Break Links in that prompt.

Code:
Sub BreakLinks()

    Dim vLinks As Variant
    Dim lLink As Long

    ' Define variable as an Excel link type.
    vLinks = ActiveWorkbook.LinkSources(Type:=xlLinkTypeExcelLinks)
    If vLinks = vbNullString Then Exit Sub

    ' Break all links in the active workbook.
    For lLink = LBound(vLinks) To UBound(vLinks)
        ActiveWorkbook.BreakLink _
                Name:=vLinks(lLink), _
                Type:=xlLinkTypeExcelLinks
    Next lLink
End Sub

I've also tried

Code:
  For Each TmpLinks In PasteTo_Wb.LinkSources
    PasteTo_Wb.BreakLink Name:=TmpLinks, Type:=xlLinkTypeExcelLinks
  Next
 
You are right, it should be in the other forum, it was late last night and I clicked the wrong forum.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top