I am trying to change the color of a connector in Visio between a switch shape and a server shape. My current code is as follows:
$From = $svrSwitch.MachName
$To = $SvrSwitch.Switch
$ConnFrom = $page.Shapes | Where {$_.name -eq $From}
$ConnTo = $page.Shapes | Where {$_.name -eq $To}
$ConnFrom.AutoConnect($ConnTo, 0, $connectorSwitch)
$arrow = $page.Shapes | Where {$_.name -eq "Dynamic Connector"} | select -First 1
$arrow.NameU = "$From-TO-$To"
$arrow.fill.ForegroundColor = 0xff0000
Of course I understand the last line is incorrect, I am just not sure how to proceed.
Thank you very much for your help.
The thing to understand is that you're writing to cells in the shape's ShapeSheet, so either of these should work:
and here's a complete example (no error handling) based on Visio 2013:
If you're not familiar with the ShapeSheet, then you might find thsi intro useful:
http://visualsignals.typepad.co.uk/vislog/2007/10/just-for-starte.html