Hi folks

I am quite a newbie to VBA so please be gentle.

I have the following VBA script that I am using to replace text in all hyperlinks within a specific Visio document (replacing %20 with a raw space to allow links to work in Chrome/Firefox).

Sub ChangeHyperlinks()' change all hyperlinks on all shapes on all pages that start with
' "%20" to start with " "
 
    Dim pg As Page
    Dim shp As Shape
    Dim hl As Hyperlink
    
    For Each pg In ActiveDocument.Pages
        For Each shp In pg.Shapes
            For Each hl In shp.Hyperlinks
                hl.Address = Replace(hl.Address, "%20", " ")
            Next
        Next
    Next
 
End Sub
However, having looked at vbaexpress.com/kb/getarticle.php?kb_id=76 I would like a way to apply the above code to all visio documents within a specific folder and subfolders. Either this or apply to all open documents, however I think that the information in this link is only for Word. The Visio version we are using is 2010.

Another issue is that we have all of our Visio docs published to HTML on a web server, so each one would need to be saved and published to HTML too, can this be applied by script also? If not then it is no big deal as I can open multiple html files with notepad++ and do a find and replace on all open docs.



Any help is much appreciated.

Thanks,

Ryan