Link to home
Start Free TrialLog in
Avatar of Jamie Garroch (MVP)
Jamie Garroch (MVP)Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Can I use VBA to set the bullet format for various indent levels of a shape's text frame, prior to text insertion/indenting?

I can use the following code to set one property of the bullet, the character, on a per-paragraph basis:
oShp.TextFrame2.TextRange.Paragraphs(1).ParagraphFormat.Bullet.Character = 123

Open in new window

I can then set different bullet characters for different levels using something like this simplified example:
With oShp.TextFrame2.TextRange.Paragraphs(1).ParagraphFormat
  .Bullet.Character = IIf(.IndentLevel = 1, 123, 456)
End With

Open in new window

My question is, can I set the bullet properties for the TextFrame on a per-level basis rather than having to apply them to existing paragraphs of text. For example, if I add a new shape to slide, set the formatting up for the TextFrame and then a user starts typing at Level 1 indentation they get character 123 and when they Indent to level 2, they automatically get character 456 without my code have to reapply formatting to that paragraph?

I know something could be done by using text-based placeholders but this won't work within table cell text frames.
SOLUTION
Avatar of Rgonzo1971
Rgonzo1971

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jamie Garroch (MVP)

ASKER

Thanks JSRWilson. Keyword spotted! I think I could make the TAB / SHIFT TAB part work but only after the user subsequently starts typing, using the SelectionChange event (which doesn't fire on an indent change but does on a TextRange change).
I did play with that but it got confusing for users. If you do get a good solution I'd like to see it!
Some new info has come to light JSRWilson. The Format Painter button can be used to preset the formatting of various indent levels of a text box by copying the format of a text box object populated with formatted multi-levelled text to a blank text box prior to typing text into that empty textbox and then tabbing the required indent level as text is typed into it. So does this mean there is something in the OM that is not being exposed?