VBA -> BackgroundFillColor

Here is my code so far:

Public Function add_Blackout()
On Error GoTo add_Blackout_Error

Dim oEnumerator As ElementEnumerator

Set oEnumerator = ActiveModelReference.GetSelectedElements
oEnumerator.BuildArrayFromContents
oEnumerator.Reset

Do While oEnumerator.MoveNext
Dim oElement As Element, oTextElement As TextElement, oTextNodeElement As TextNodeElement
Set oElement = oEnumerator.Current

If oElement.IsTextElement Then

Set oTextElement = oElement.AsTextElement

With oTextElement
.TextStyle.BackgroundFillColor = 255
.TextStyle.BorderColor = 255
.TextStyle.BorderAndBackgroundVisible = True
.Redraw
.Rewrite
End With
End If

If oElement.IsTextNodeElement Then

Set oTextNodeElement = oElement.AsTextNodeElement

With oTextNodeElement
.
.AsComplexStringElement.AsTextElement.TextStyle.BackgroundFillColor = 255
.AsComplexStringElement.AsTextElement.TextStyle.BorderColor = 255
.AsComplexStringElement.AsTextElement.TextStyle.BorderAndBackgroundVisible = True
.Redraw
.Rewrite
End With
End If

Loop

add_Blackout_Error:
If Err.Description = "" Then
' Do Nothing
Else: MsgBox Err.Description
End If
End Function

If I have selected a large grouping of Text and run this code, it works for the TextElements, but not the TextNodeElements. All I want to do is change the Background Color of the selected elements. I know they are all TextElements or TextNodeElements, but I can't find the code necessary to affect the TextNode TextStyles... does anyone have any hints?

Do I have to numerate through the TextElements in the TextNodeElement and change each of their styles? If so, I can't find code to enumerate through the array inside a TextNodeElement... frustrated.
Parents Reply Children
No Data