Reputation: 1
I have created visio connection rows using the following:
NewRow = grpObj.AddRow(visSectionConnectionPts, visRowLast, visTagDefault)
but the name field of the resulting connection row is blank. I want to get a reference to the name field so that I can edit it using the formula method, but I cannot see the visio cell index for the name.
Upvotes: 0
Views: 466
Reputation: 211
Just wanted to add: cells in named rows have RowName and RowNameU property. RowNameU (U for Universal) is essentially the "original" name, and RowName is the current name, which might be a rename of the original.
This was provided for localization, but is probably not used very much. You could have RowNameU = "George" and RowName = "Jorge" for Spanish users, but your code could continue unchanged, relying on If...RowNameU == "George".
It's a nitpick that you likely won't encounter, but "U" issues pop up in things like page names (especially links to shapes on different pages), so "U" concepts is good to introduce to Visio develpers.
Upvotes: 0
Reputation: 2698
Connection rows can be named or un-named. Once a single row is named the entire section gets converted to named rows. So you can always add new rows by index (AddRow
), but if you want to name them the you need the AddNamedRow
method.
If you put a break point on the End Sub
line below you'll see the different ways of adding the rows and accessing them once they exist.
Public Sub AddConnectionsDemo()
Dim sect As Integer
sect = Visio.VisSectionIndices.visSectionConnectionPts
Dim shp As Visio.Shape
Set shp = ActiveWindow.Selection.PrimaryItem
'Add un-named Connection row
Dim r1 As Integer
r1 = shp.AddRow(sect, visRowLast, visTagDefault)
Dim firstY As Double
firstY = shp.CellsSRC(sect, Visio.VisRowIndices.visRowFirst + r1, Visio.VisCellIndices.visCnnctY).ResultIU
'Add named Connection row
Dim rowName As String
rowName = "MyConn"
Dim r2 As Integer
r2 = shp.AddNamedRow(sect, rowName, Visio.VisRowTags.visTagCnnctNamed)
'note r2 is a bit redundant as you know the row name at this point,
'but you could still access it by index (SRC) if you prefer
Dim secondY As Double
secondY = shp.CellsU("Connections." & rowName & ".Y").ResultIU
End Sub
Upvotes: 2