Posted on April 18 2023 under networking and visio
Public Sub ExportPagesAsPNG()
' Set the export settings
Dim settings As Visio.ApplicationSettings
Set settings = Visio.Application.settings
settings.SetRasterExportResolution (visRasterUsePrinterResolution)
settings.SetRasterExportSize (visRasterFitToSourceSize)
' Prepare the export file paths
Dim basePath As String
Set fso = CreateObject("Scripting.FileSystemObject")
basePath = fso.BuildPath(ActiveDocument.path, fso.GetBaseName(ActiveDocument.Name)) + " - "
' Export each page
Dim count As Integer
Dim page As Visio.page
count = 0
For Each page In ActiveDocument.Pages
' Skip background pages
If page.Background = False Then
page.Export (basePath + page.Name + ".png")
count = count + 1
End If
Next
' Print status
MsgBox ("Exported " + CStr(count) + " pages to " + ActiveDocument.path)
End Sub