我正试图通过我编写的Excel宏使Visio中的一个层可见。然而,我总是一个无效的参数错误。
这是我的代码:
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应为短整数。