Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Feb 2002
    Location
    Taranaki, New Zealand
    Posts
    193
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Changing hyperlinks (Visio 2003)

    Visio isn't really me and I have a problem. Someone has created a folder and they called it "word documents" (extremely original to say the least).
    I have about 150 visio maps with many hyperlinks to word documents in this folder.
    I would like to rename this folder, but when I do that all the hyperlinks stop working. I had hoped they would automatically default to the new folder name.

    Is there a way for me, to quickly change the hyperlinks or do I have to change them one by one, in which case I probably leave the folder name as it is now.

    Thanks for any help

  2. #2
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Changing hyperlinks (Visio 2003)

    This little macro will rename all the Hyperlinks on the current visio page. Depending on what you are doing you may need to enclose this in a loop that visits every Document, or every page in the current Document.

    <code>
    Sub RenameHyperlinks(txtOld As String, txtNew As String)
    Dim hyp As Hyperlink
    Dim shp As Shape
    For Each shp In ActivePage.Shapes
    For Each hyp In shp.Hyperlinks
    hyp.Address = Replace(hyp.Address, txtOld, txtNew)
    Next hyp
    Next shp
    End Sub
    </code>



    Here is the small Macro I used to test it.
    <code>
    Sub Testit()
    RenameHyperlinks "Stuart", "Someone Else"
    End Sub
    </code>



    StuartR

    Edited by StuartR to add
    Here is a slightly longer version that replaces the hyperlinks on every page of every open document.
    <code>
    Sub RenameHyperlinks(txtOld As String, txtNew As String)
    Dim hyp As Hyperlink
    Dim shp As Shape
    Dim doc As Document
    Dim pg As Page

    For Each doc In Application.Documents
    For Each pg In doc.Pages
    For Each shp In pg.Shapes
    For Each hyp In shp.Hyperlinks
    hyp.Address = Replace(hyp.Address, txtOld, txtNew)
    Next hyp
    Next shp
    Next pg
    Next doc
    End Sub
    </code>

Posting Permissions

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