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

浪子不回头ぞ 提交于 2019-12-10 11:16:55

问题


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?


回答1:


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


来源:https://stackoverflow.com/questions/13413348/how-to-convert-multiple-visio-file-vsd-to-png

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!