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!

Method for 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
 
hi,

Code:
If [highlight #FCE94F]IsEmpty(vLinks)[/highlight] Then Exit Sub

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Skip,

The array shouldn't be empty, there are links in the workbook that I want to be broken. It's not seeing them and breaking them.
 


I can't figure out why it's not working now

Please explain EXACTLY what is not working and how you determine that it is not working.

Please post as much detail information as possible to support your allegation.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Skip,

Nevermind, the change you suggested is working. I changed that subroutine in my code but the call to it in my main Sub was still commented out so I didn't think it worked.

Thank you for the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top