Long Time VBA user - new to VBA in Visio - still haven't figured out how to refer to shapes and their properties (or is that Cells ?)
I have code that draws 4 lines on a page, then selects the 4 lines and joins them. After the join, I want to fill the joined shape with a color.
I recorded a macro to learn how to do this but it has the joined shape's ItemFromId index hard coded (see below).
[COLOR=red yellow]Dim UndoScopeID1 As Long
UndoScopeID1 = Application.BeginUndoScope("Fill Properties")
Application.ActiveWindow.Page.Shapes.ItemFromID(5).CellsSRC(visSectionObject, visRowFill, visFillForegnd).FormulaU = "RGB(255,255,150)"
Application.ActiveWindow.Page.Shapes.ItemFromID(5).CellsSRC(visSectionObject, visRowFill, visFillPattern).FormulaU = "1"
Application.EndUndoScope UndoScopeID1, True[/color]
If there are already shapes on the page when I run the code, the ItemFromId index probably won't be 5. How do I get the true ItemFromID index from the newly joined shape.
Thanks for your help.
I have code that draws 4 lines on a page, then selects the 4 lines and joins them. After the join, I want to fill the joined shape with a color.
I recorded a macro to learn how to do this but it has the joined shape's ItemFromId index hard coded (see below).
[COLOR=red yellow]Dim UndoScopeID1 As Long
UndoScopeID1 = Application.BeginUndoScope("Fill Properties")
Application.ActiveWindow.Page.Shapes.ItemFromID(5).CellsSRC(visSectionObject, visRowFill, visFillForegnd).FormulaU = "RGB(255,255,150)"
Application.ActiveWindow.Page.Shapes.ItemFromID(5).CellsSRC(visSectionObject, visRowFill, visFillPattern).FormulaU = "1"
Application.EndUndoScope UndoScopeID1, True[/color]
If there are already shapes on the page when I run the code, the ItemFromId index probably won't be 5. How do I get the true ItemFromID index from the newly joined shape.
Thanks for your help.