W
will48
I'd like some help with macro code for toggling the colour of a Visio shape
when clicked. For example, fill colour alternates between red and green on
each click.
I can make one or more shapes turn red with a button and code:
Private Sub CommandButtonRed_Click()
Dim UndoScopeID1 As Long
UndoScopeID2 = Application.BeginUndoScope("Fill Properties")
Application.ActiveWindow.Page.Shapes.ItemFromID(1).CellsSRC
(visSectionObject, visRowFill, visFillForegnd).FormulaU = "2"
Application.ActiveWindow.Page.Shapes.ItemFromID(8).CellsSRC
Application.EndUndoScope UndoScopeID1, True
End Sub
And a similar code for the turn green button.
However, this would require two buttons per shape, and I have many shapes.
Any help appreciated.
Will
when clicked. For example, fill colour alternates between red and green on
each click.
I can make one or more shapes turn red with a button and code:
Private Sub CommandButtonRed_Click()
Dim UndoScopeID1 As Long
UndoScopeID2 = Application.BeginUndoScope("Fill Properties")
Application.ActiveWindow.Page.Shapes.ItemFromID(1).CellsSRC
(visSectionObject, visRowFill, visFillForegnd).FormulaU = "2"
Application.ActiveWindow.Page.Shapes.ItemFromID(8).CellsSRC
Application.EndUndoScope UndoScopeID1, True
End Sub
And a similar code for the turn green button.
However, this would require two buttons per shape, and I have many shapes.
Any help appreciated.
Will