P
Paul
I have grand aspirations to create macros that turn all connections’
text labels transparent, and to turn them visible (white text block
background, text color set to the same as the line color). I started
with something very simple. Or more truthfully, I was forced to
reduce it to the following debugging script.
Public Sub LnLblOn()
Dim shp As Shape
Visio.ActiveWindow.DeselectAll
For Each shp In Visio.ActivePage.Shapes
If shp.OneD Then
'shp.CellsSRC(visSectionObject, visRowText,
visCharacterColor).FormulaU = shp.Cells("LineColor")
shp.CellsSRC(visSectionObject, visRowText,
visCharacterColor).FormulaU = "3"
End If
Next shp
End Sub
I expected this script to set the text color of all connection labels
to “3” (whatever that color is). Hoever, it doesn’t change the color
of any of the labels, regardless of what color they were originally,
and regardless of what color the line is. Instead, it sets all the
text boxes’ right margins to 76.2mm. Why would this be?
Aside from the field that is being changed, there is not much
difference between the above code and the following (properly working)
code for clearing the text block background, and setting it to white:
Public Sub LnLblBkgndClr()
Dim shp As Shape
Visio.ActiveWindow.DeselectAll
For Each shp In Visio.ActivePage.Shapes
If shp.OneD Then
shp.CellsSRC(visSectionObject, visRowText,
visTxtBlkBkgnd).FormulaU = "0"
End If
Next shp
End Sub
Public Sub LnLblBkgndWht()
Dim shp As Shape
Visio.ActiveWindow.DeselectAll
For Each shp In Visio.ActivePage.Shapes
If shp.OneD Then
shp.CellsSRC(visSectionObject, visRowText,
visTxtBlkBkgnd).FormulaU = "2"
End If
Next shp
End Sub
text labels transparent, and to turn them visible (white text block
background, text color set to the same as the line color). I started
with something very simple. Or more truthfully, I was forced to
reduce it to the following debugging script.
Public Sub LnLblOn()
Dim shp As Shape
Visio.ActiveWindow.DeselectAll
For Each shp In Visio.ActivePage.Shapes
If shp.OneD Then
'shp.CellsSRC(visSectionObject, visRowText,
visCharacterColor).FormulaU = shp.Cells("LineColor")
shp.CellsSRC(visSectionObject, visRowText,
visCharacterColor).FormulaU = "3"
End If
Next shp
End Sub
I expected this script to set the text color of all connection labels
to “3” (whatever that color is). Hoever, it doesn’t change the color
of any of the labels, regardless of what color they were originally,
and regardless of what color the line is. Instead, it sets all the
text boxes’ right margins to 76.2mm. Why would this be?
Aside from the field that is being changed, there is not much
difference between the above code and the following (properly working)
code for clearing the text block background, and setting it to white:
Public Sub LnLblBkgndClr()
Dim shp As Shape
Visio.ActiveWindow.DeselectAll
For Each shp In Visio.ActivePage.Shapes
If shp.OneD Then
shp.CellsSRC(visSectionObject, visRowText,
visTxtBlkBkgnd).FormulaU = "0"
End If
Next shp
End Sub
Public Sub LnLblBkgndWht()
Dim shp As Shape
Visio.ActiveWindow.DeselectAll
For Each shp In Visio.ActivePage.Shapes
If shp.OneD Then
shp.CellsSRC(visSectionObject, visRowText,
visTxtBlkBkgnd).FormulaU = "2"
End If
Next shp
End Sub