chro
chro

Reputation: 95

How to convert multiple visio file (.vsd) to png

I have a lot of Visio files, and want to programatically convert them all to png format.

I have found a couple of solutions, but can't get any of them to work.

How can .vsd files be batch-converted to .png easily through commandline or a similar means?

Upvotes: 2

Views: 3662

Answers (1)

Mesh
Mesh

Reputation: 6442

Use the built in Visual Basic

something like this: fix up the paths parts yourself.

Sub a()

   Dim docs As New Collection
   ' add the paths of your documents here, use more script if you want wildcard etc
   docs.Add ("C:\Users\[username]\Desktop\New folder (4)\drawing2.vsd")
   docs.Add ("C:\Users\[username]\Desktop\New folder (4)\drawing3.vsd")

   For Each d In docs    
      Dim doc As Document     
      Set doc = Documents.Add(d)

      Dim p As Page

        For Each p In doc.Pages       
        Dim n As String

        ' change this for the output path and format of your choice      
        n = "C:\Users\[username]\Desktop\New folder (4)\" & doc.Name & " " & p.Index & ".png"      
        p.Export (n)

        Next
    Next

End sub

Upvotes: 2

Related Questions