多页面Visio文档中所有图层的列表
问题描述:
我有一个包含40个页面/选项卡的Visio文档。每个页面都有多个图层,并且我试图生成文档中所有图层的列表,以便我可以确认命名约定已被遵守,而无需单独浏览每个页面。多页面Visio文档中所有图层的列表
有谁知道是否有可能输出这样的清单 例如
- foo_layer
- bar_layer
- 页2
- foo_layer
- x_layer 等
答
当然,它是对ossible。例如,您可以使用VBA宏来完成任务,或使用外部脚本。 Visio拥有丰富的API;你可以查看关于这个的官方文档。
答
谢谢尼古拉。 我希望能够找到一些开箱即用的东西,但VBA来救援。如果这是对别人有用这里是我的代码:
Sub List_page_Layers()
Dim Pageobj As Visio.Page
Dim PageLayer As Visio.Layer
Dim myFile As String
Dim layerVal As String
Dim searchString as String
searchString = "SOME TEXT" 'This allows me to filter as there were a couple of pages I wasn't interested and all other pages had a common string in their name
myFile = "C:\\Temp\\Layers.txt"
Open myFile For Output As #1
For Each Pageobj In ActiveDocument.Pages
If InStr(Pageobj.Name, searchString) Then
For Each PageLayer In Pageobj.Layers
layerVal = Pageobj.Name & " - " & PageLayer.Name
Write #1, layerVal
Next
End If
Next
Close #1
End Sub
这与输出层名称的文本文件,该文件根据需要
然后我就可以使用