通过 Excel 宏使 Visio 图层可见
Make Visio layer visible through Excel macro
我试图通过我编写的 Excel 宏使 Visio 中的图层可见。但是,我总是一个invalid parameter的错误。
这是我的代码:
Sub visio_change_shape(index_value As Variant)
Dim AppVisio As Object
Dim VisioSystems As Object
Set AppVisio = GetObject(, "Visio.Application")
AppVisio.Pages(1).Layers.Item(index_value).CellsC(visLayerVisible).FormulaU = "1"
End Sub
但是,在 visio 中,同一行有效:
Private Sub Select_layers()
Dim vsoPage As Visio.Page
Dim vsoShape As Visio.Shape
Dim vsoLayers As Visio.Layers
Dim vsoLayer As Visio.Layer
Set vsoPage = ActivePage
Set vsoLayers = vsoPage.Layers
vsoLayer.CellsC(visLayerVisible).FormulaU = "1"
Next
End Sub
感谢任何线索!
您真正需要的是:
ActiveDocument.Pages(1).Layers.Item(index_value).CellsC(visLayerVisible).Formula = "1"
index_value 应该是一个短整数。
我试图通过我编写的 Excel 宏使 Visio 中的图层可见。但是,我总是一个invalid parameter的错误。
这是我的代码:
Sub visio_change_shape(index_value As Variant)
Dim AppVisio As Object
Dim VisioSystems As Object
Set AppVisio = GetObject(, "Visio.Application")
AppVisio.Pages(1).Layers.Item(index_value).CellsC(visLayerVisible).FormulaU = "1"
End Sub
但是,在 visio 中,同一行有效:
Private Sub Select_layers()
Dim vsoPage As Visio.Page
Dim vsoShape As Visio.Shape
Dim vsoLayers As Visio.Layers
Dim vsoLayer As Visio.Layer
Set vsoPage = ActivePage
Set vsoLayers = vsoPage.Layers
vsoLayer.CellsC(visLayerVisible).FormulaU = "1"
Next
End Sub
感谢任何线索!
您真正需要的是:
ActiveDocument.Pages(1).Layers.Item(index_value).CellsC(visLayerVisible).Formula = "1"
index_value 应该是一个短整数。