+ Reply to Thread
Results 1 to 2 of 2

Break all links in the workbook

  1. #1
    striker72s
    Guest

    Break all links in the workbook


    Hello,

    IV been trying to break links in excel workbooks by VBA
    But I wanted to know how to break all the links in the workbooks, not
    just one single link

    ActiveWorkbook.BreakLink Name:= _
    "\\excel\Portfolios\sample.xls" _
    , Type:=xlExcelLinks

    This code breaks single link, but is there a code to break them all.

    Thanks in advance


    --
    striker72sPosted from http://www.pcreview.co.uk/ newsgroup access


  2. #2
    John
    Guest

    Re: Break all links in the workbook

    Hi there,

    The LinkSources method returns an array of links so then it's just a matter
    of stepping backwards through each one and deleting them. I'm not sure if
    there's a method to delete the "links collection" (can anyone enlighten
    me?). Anyway, this seems to do the job.

    Best regards

    John

    Sub BreakAllWorkbookLinks()

    aLinks = ActiveWorkbook.LinkSources(xlExcelLinks)
    If Not IsEmpty(aLinks) Then
    For i = 1 To UBound(aLinks) Step -1
    Debug.Print aLinks(i)
    Application.ActiveWorkbook.BreakLink _
    Name:=aLinks(i), _
    Type:=xlLinkTypeExcelLinks
    Next i
    End If

    End Sub


    "striker72s" <striker72s.1rdnry@> wrote in message
    news:ru-dndij6fNHzV_fRVn_vg@giganews.com...
    >
    > Hello,
    >
    > IV been trying to break links in excel workbooks by VBA
    > But I wanted to know how to break all the links in the workbooks, not
    > just one single link
    >
    > ActiveWorkbook.BreakLink Name:= _
    > "\\excel\Portfolios\sample.xls" _
    > , Type:=xlExcelLinks
    >
    > This code breaks single link, but is there a code to break them all.
    >
    > Thanks in advance
    >
    >
    > --
    > striker72sPosted from http://www.pcreview.co.uk/ newsgroup access
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1