How can I append a character style?

I am trying to append a (nested) character style to a word that is already part of a sentence that has a character style applied. I know how to do this manually, but need to do it with a macro.

I can get the CharStyleNames array from the paragraph section, but how do I modify it? Setting CharStyleName just overwrites the existing style.

I dont even know any way to do this manually ( in the sense: combining two CHARSTYLES into one Textportion ) ??

It can be done manually by SHIFT selecting a second style. Both styles are listed in the CharStyleNames array. I’m just not sure how to modify the CharStyleNames array in the paragraph section from a macro.

You lost me… is it a new Gimmick mentioned here ??

So, to be less specific, I’m looking for a way to modify an array in a LO object. (Specifically, the CharStyleNames array in SwXTextPortion).

I figured it out. This appends a new style to the existing ones:

charStyleNames = oParSection.charStyleNames
lb = LBound(charStyleNames)
ub = UBound(charStyleNames) + 1
redim preserve charStyleNames(lb to ub)
charStyleNames(ub) = "NewStyle"
oParSection.charStyleNames = charStyleNames