Skip to content

Instantly share code, notes, and snippets.

@xsnpdngv
Created February 17, 2017 09:43
Show Gist options
  • Save xsnpdngv/6c67b7c0a1cebe5c2938e2dc41eec175 to your computer and use it in GitHub Desktop.
Save xsnpdngv/6c67b7c0a1cebe5c2938e2dc41eec175 to your computer and use it in GitHub Desktop.
Visio macro to export each page to svg
Sub exportSvg()
Dim formatExtension As String
formatExtension = ".svg"
' initializations
folder = ThisDocument.Path
Set doc = Visio.ActiveDocument
folder = doc.Path
' for each page
For Each pg In doc.Pages
' set filename
FileName = Left(doc.Name, Len(doc.Name) - 4) & "_" & pg.Name
' skip background pages
If (Not (pg.Background)) Then
' add extension
FileName = FileName & formatExtension
' save
Call pg.Export(folder & FileName)
End If
Next
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment