I have the following VBA script that I am using to replace addresses 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
I would like a way to apply the above code to all Visio documents within a specific folder and subfolders.
You would want, probably, to use the FileSystemObject class to generate a list of all VBA files in a folder, including sub-folders. There should be examples if you search for FileSystemObject and VBA.
You could then loop through the list of file paths, and use Visio's Application.Documents.Open routine to open each file, run your ChangeHyperlinks macro, then save and close the file.