+ Reply to Thread
Results 1 to 8 of 8

break excel links

  1. #1
    Registered User
    Join Date
    07-02-2005
    Posts
    3

    Question break excel links

    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

  2. #2
    Ron de Bruin
    Guest

    Re: break excel links

    Hi striker72s

    You can run this macro also to make text of all hyperlinks
    in your worksheet

    Sub test()
    ActiveSheet.Hyperlinks.Delete
    End Sub

    Alt-F11
    Insert>Module from the menubar
    paste the sub in there
    Alt-Q to go back to Excel

    If you do Alt-F8 you get a list of your macro's
    Select "test" and press Run


    --
    Regards Ron de Bruin
    http://www.rondebruin.nl


    "striker72s" <[email protected]> wrote in message
    news:[email protected]...
    >
    > 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
    >
    >
    > --
    > striker72s
    > ------------------------------------------------------------------------
    > striker72s's Profile: http://www.excelforum.com/member.php...o&userid=24862
    > View this thread: http://www.excelforum.com/showthread...hreadid=384061
    >




  3. #3
    Registered User
    Join Date
    07-02-2005
    Posts
    3

    Question it didn't work

    iv tryed it , the datalinks didnt break ??

    ActiveSheet.Hyperlinks.Delete

  4. #4
    Dave Peterson
    Guest

    Re: break excel links

    I stole the code from VBA's help and modified it to go through all the links:

    Option Explicit
    Sub UseBreakLink2()

    Dim astrLinks As Variant
    Dim iCtr As Long

    astrLinks = ActiveWorkbook.LinkSources(Type:=xlLinkTypeExcelLinks)

    If IsArray(astrLinks) Then
    For iCtr = LBound(astrLinks) To UBound(astrLinks)
    ActiveWorkbook.BreakLink Name:=astrLinks(iCtr), _
    Type:=xlLinkTypeExcelLinks
    Next iCtr
    End If

    End Sub



    striker72s wrote:
    >
    > 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
    >
    > --
    > striker72s
    > ------------------------------------------------------------------------
    > striker72s's Profile: http://www.excelforum.com/member.php...o&userid=24862
    > View this thread: http://www.excelforum.com/showthread...hreadid=384061


    --

    Dave Peterson

  5. #5
    Dave Peterson
    Guest

    Re: break excel links

    Ron guessed that you were writing about hyperlinks--not links to other
    workbooks.


    striker72s wrote:
    >
    > iv tryed it , the datalinks didnt break ??
    >
    > ActiveSheet.Hyperlinks.Delete
    >
    > --
    > striker72s
    > ------------------------------------------------------------------------
    > striker72s's Profile: http://www.excelforum.com/member.php...o&userid=24862
    > View this thread: http://www.excelforum.com/showthread...hreadid=384061


    --

    Dave Peterson

  6. #6
    Dave Peterson
    Guest

    Re: break excel links

    ps. If you want to see the stuff with the links and decide later to break them
    (or not)...

    Use Bill Manville's FindLink program:
    http://www.oaltd.co.uk/MVP/Default.htm

    striker72s wrote:
    >
    > 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
    >
    > --
    > striker72s
    > ------------------------------------------------------------------------
    > striker72s's Profile: http://www.excelforum.com/member.php...o&userid=24862
    > View this thread: http://www.excelforum.com/showthread...hreadid=384061


    --

    Dave Peterson

  7. #7
    Registered User
    Join Date
    07-02-2005
    Posts
    3

    Smile it worked

    Dave, iv tried the code and it worked,
    Thanks a lot guys for the help. Now, ill try to transform it to C#

  8. #8
    Ron de Bruin
    Guest

    Re: break excel links

    Thanks Dave

    --
    Regards Ron de Bruin
    http://www.rondebruin.nl


    "Dave Peterson" <[email protected]> wrote in message news:[email protected]...
    > Ron guessed that you were writing about hyperlinks--not links to other
    > workbooks.
    >
    >
    > striker72s wrote:
    >>
    >> iv tryed it , the datalinks didnt break ??
    >>
    >> ActiveSheet.Hyperlinks.Delete
    >>
    >> --
    >> striker72s
    >> ------------------------------------------------------------------------
    >> striker72s's Profile: http://www.excelforum.com/member.php...o&userid=24862
    >> View this thread: http://www.excelforum.com/showthread...hreadid=384061

    >
    > --
    >
    > Dave Peterson




+ 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