title: Make Visio layer visible through Excel macro
body: <p>I am trying to make a layer in Visio visible through an Excel Macro, that I wrote. However, I always an invalid parameter error.</p>
  <p>This is my code:</p>
  <pre><code>Sub visio_change_shape(index_value As Variant)
  
  Dim AppVisio As Object
  Dim VisioSystems As Object
  
  Set AppVisio = GetObject(, &quot;Visio.Application&quot;)
  
  AppVisio.Pages(1).Layers.Item(index_value).CellsC(visLayerVisible).FormulaU = &quot;1&quot;
  
  End Sub
  </code></pre>
  <p>However, in visio the same line works:</p>
  <pre><code>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 = &quot;1&quot;
  
  Next
  
  End Sub
  </code></pre>
  <p>Thanks for any leads!</p>