Convert Visio Pages to Images in

I have been fooling around with Visio automation since attempting to help a friend with a project that did so. In the course of this I did this code snippet to convert the Visio page to an image. The code loops through and takes each page and converts it to an image. Pretty basic. I have not posted in a while and my apologies to those of you who were wondering…. Smile

Here is the code….

Sub SaveAsImage()
‘ creates an invisible Visio instance, opens a document, then
‘ saves all pages in the document as jpg images using
‘ page name and page number as file name
    Dim vsoApp As Visio.Application
    Dim vsoDoc As Visio.Document
    Dim PathName As String, jpgName As String
    Dim pg As Visio.Page
    Set vsoApp = CreateObject(“Visio.InvisibleApp”)
    Set vsoDoc = vsoApp.Documents.Open(“c:\TEST\test.vsd”)
    PathName = vsoApp.Documents(1).Path      ‘ Set pathname to that of first document
    For Each pg In vsoApp.ActiveDocument.Pages
        jpgName = PathName & Format(pg.Index, “0#”) & ” ” & pg.Name & “.jpg”
        pg.Export jpgName
    Set vsoDoc = Nothing
    Set vsoApp = Nothing
End Sub


, , , , , , , , , , , , , , , , , , , , , , , ,

  1. #1 by Viral Sarvaiya on May 18, 2012 - 12:40 am

    Thanks kelly,
    its helps me. 🙂

  2. #2 by emily on December 5, 2013 - 1:41 am

    I have also found a code in to convert visio supported file formats to image, i have tried that code and it work really well, so should try it also:

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: