Um, the code sample doesn't add any Geometry rows, so I'm not sure which test failed, exactly.
That macro code is hard to use, you really need to replace some of that stuff with a variable to make it easier (for others) to test. The sample only works with a specific shape with an ID of 5, which is a pain to recreate.
I suggest:
Dim shp As Visio.Shape
Set shp = Visio.ActiveWindow.Selection(1)
'Now replace any occurrence of
' Application.ActiveWindow.Page.Shapes.ItemFromID(5).
' with shp.
I cleaned up the macro code and made a sub that randomly adds points to the end of Geometry 1 of the selected shape:
Sub AddGeometryLineToSelectedConnector()
'// Geometry1:
Const SEC% = Visio.VisSectionIndices.visSectionFirstComponent
' Dim DiagramServices As Integer
' DiagramServices = ActiveDocument.DiagramServicesEnabled
' ActiveDocument.DiagramServicesEnabled = visServiceVersion140 + visServiceVersion150
'// Select a Dynamic Connector in the active window,
'// Press F5 over and over to run this sub.
Dim shp As Visio.Shape
Set shp = Visio.ActiveWindow.Selection(1)
Dim iRowCt As Integer
iRowCt = shp.RowCount(SEC%)
Dim iNewRow As Integer
'// Add a row to at N-1 in Geometry1:
iNewRow = shp.AddRow(SEC%, _
Visio.VisRowIndices.visRowLast, _
Visio.VisRowTags.visTagLineTo)
Dim x As Double, y As Double
x = VBA.Rnd(1)
y = VBA.Rnd(1)
'// Set the X and Y formulas for the new row:
shp.CellsSRC(SEC%, _
iNewRow, _
Visio.VisCellIndices.visX).FormulaForceU = "Width*" & x
shp.CellsSRC(SEC%, _
iNewRow, _
Visio.VisCellIndices.visY).FormulaForceU = "Height*" & y
'Restore diagram services
'ActiveDocument.DiagramServicesEnabled = DiagramServices
End Sub
(In Visio 2010) If you draw a 1D line, you can see that it works. If you use it on a Dynamic Connector, then nothing. Regardless of the diagram services stuff. If you step through it line by line (F8), once in awhile you will see an extra Geometry row, that sometunes disappears as you step. Sometimes, I was able to get rows to appear and stay. Visio seems to be recalculating the connector whenever something changes.
I couldn't manually add a row via the ShapeSheet either. It is very weird!
Here's another idea that might work:
1. Create a new geometry section (ie: Geometry2)
2. Configure the rows the way you want
3. Delete Geometry1. Geometry2 becomes Geometry1 and will be governed by connector behavior, but Visio doesn't seem to whack it right away!
I haven't had time to fully test this idea.