Step 3 - Format Text

This third step shows how text can be formatted. With Text Control's text formatting properties, the complete layout of a document can be controlled.

tx.FormatSelection = true
tx.FontSize = 17
tx.FontName = "Times New Roman"  
tx.SelText = "TX Text Control Step 3" & vbCrLf

This example alters the font name and size at the current input position and inserts a line of text. The new line is formatted with the previously specified attributes. You can also select a text fragment with the SelStart and SelLength properties and alter any attribute of a character or paragraph after inserting text. For a detailed overview of all properties that handle formatting attributes see Programming Categories - Character Formatting and Programming Categories - Paragraph Formatting.