A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Powerpoint, Publisher and Visio » Visio
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Macro code to modify connection label (Visio 2003)



 
 
Thread Tools Display Modes
  #1  
Old July 22nd, 2008, 08:49 PM posted to microsoft.public.visio.general
Paul
external usenet poster
 
Posts: 406
Default Macro code to modify connection label (Visio 2003)

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
  #2  
Old July 22nd, 2008, 08:58 PM posted to microsoft.public.visio.general
Paul
external usenet poster
 
Posts: 406
Default SOLVED: Macro code to modify connection label (Visio 2003)

Found the problem. The arguments in the CellsSRC function are
different when formatting text color versus background color of a text
box. Thanks anyway.

On Jul 22, 3:49*pm, Paul wrote:
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


  #3  
Old July 25th, 2008, 11:59 PM posted to microsoft.public.visio.general
WapperDude
external usenet poster
 
Posts: 589
Default Macro code to modify connection label (Visio 2003)

Change your text color line --
from: shp.CellsSRC(visSectionObject, visRowText,
visCharacterColor).FormulaU = "3"

to: shp.CellsSRC(visSectionCharacter, 0, visCharacterColor).FormulaU =
"RGB(255,0,0)"

You may use the color index method, e.g., "3", which is green, or as shown,
the RGB method and make any color you want.

Enjoy!
Wapperdude



"Paul" wrote:

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

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:26 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.