VBA for Visio 2013另存为SVG [英] VBA for Visio 2013 to save as SVG

查看:475
本文介绍了VBA for Visio 2013另存为SVG的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个宏,该宏将允许我将当前的Visio绘图另存为SVG文件.

I need a macro which will allow me to save the current Visio drawing as an SVG file.

目前最快的方法是使用 F12 键盘快捷键,该快捷键为我提供了另存为"对话框,但是每次我必须选择正确的输出文件(即PNG)时,然后输入文件名.

The quickest way I can do at the moment is to use the F12 keyboard shortcut which gives me the Save As dialog, but still each time I have to select the proper output file, i.e. PNG, and then write the name of the file.

是否可以自动执行此操作?我一直在寻找Visio中的宏录制"之类的东西,但是找不到.

Is it possible to automate this? I was looking for something like Macro recording in Visio, but couldn't find that.

推荐答案

适用于.bmp,.dib,.dwg,.dxf,.emf,.emz,.gif,.htm,.jpg,.png的文件格式,.svg,.svgz,.tif或.wmf

For file formats of .bmp, .dib, .dwg, .dxf, .emf, .emz, .gif, .htm, .jpg, .png, .svg, .svgz, .tif, or .wmf

扩展名将定义格式.

Dim vsoPage As Visio.Page 
Set vsoPage = ActivePage 
vsoPage.Export ("C:\\myExportedPage.svg") 

这里是循环循环导出每个页面的示例.

Here is an example of looping all pages exporting each one.

Dim PgObj    As Visio.Page 
Dim Pgs      As Visio.Pages 
Dim filename As String 
Dim PgName   As String 
Dim iPgs     As Integer 

'Set a handle to the pages collection
Set Pgs = Application.ActiveDocument.Pages 

'Loop Pages collections
For iPgs = 1 To Pgs.Count 
    'Set a handle to a page
    Set PgObj = Pgs(iPgs) 

    'Get Page name
    PgName = PgObj.Name 
    'Create path to save svg file
    filename = Application.ActiveDocument.Path & PgName & ".svg" 
    'Export the page as svg file
    PgObj.Export filename 
Next iPgs 

'Clean Up
Set PgObj = Nothing 
Set Pgs = Nothing 

这篇关于VBA for Visio 2013另存为SVG的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆