Yes, there is. (At least, currently there is).
Here is the part of the function I am calling that sets Selection to the single shape.
If oShp.Visible Then
' Selecting invisible shapes causes macro to fail
oShp.Select
End If
If oShp.Type = 17 Then 'http://www.vbcity.com/forums/topic.asp?tid=32967
'Type 17 is "TextBox with Text",
'6 is Group, so lets avoid those.
'oShp.Select
With Selection.Font
.Color = RGB(text_color_r, text_color_g, text_color_b)
'.ColorIndex = color_index
End With
End If
If oShp.Type = 1 Then 'http://www.vbcity.com/forums/topic.asp?tid=32967
'Type 17 is "TextBox with Text",
'6 is Group, so lets avoid those.
'9 is Line
'' I still must include the "alternative text"
'' check, since I cannot insert blank text inside
'' Connector
If oShp.AlternativeText <> "" Then
With Selection.Font
.Color = RGB(text_color_r, text_color_g, text_color_b)
' .ColorIndex = color_index
End With
End If
End If
If oShp.Type = 6 Then
For ctr = 1 To oShp.GroupItems.Count
If oShp.GroupItems(ctr).Type = 1 And oShp.GroupItems(ctr).Visible Then
oShp.GroupItems(ctr).Select
'MsgBox oShp.GroupItems(ctr).Name
With Selection.Font
.Color = RGB(text_color_r, text_color_g, text_color_b)
'.ColorIndex = color_index
End With
End If
Next ctr
End If 'If Group
As you can see, it's a bit of a mess. I am basically trying to "dim" (change the color to light gray) text which happens in some of my shapes.
Because not all shapes have text in them, I am having to do all kinds of Ifs to avoid breaking code.
This function, in theory, has a way to access the name of the shape inside which I want to dim the text (if there is some) so there is probably a way to code it more efficiently using that. I am sure there is. But I don't have the time at this point to work on optimization (need a little more VBA experience before I get there).
This probably for a different thread, though. Thanks for asking.
Bookmarks