I need to insert some formatted text into MS Word document. I started MS Word Macro and entered this code:
Code:
    Selection.TypeText Text:="Test Macro Color Red "
    Selection.Font.Size = 20
    Selection.TypeText Text:="Size Changed "
    Selection.Font.ColorIndex = wdGreen
    Selection.TypeText Text:="ColorIndex set "
    Selection.Font.Bold = True
    Selection.TypeText Text:="Bold "
    Selection.Font.Underline = wdUnderlineSingle
    Selection.TypeText Text:="Undeline "
    Selection.Font.ColorIndex = wdRed
    Selection.TypeText Text:="TextColor set"
When I run this macro I get what I wanted:
Name:  TextColor.jpg
Views: 327
Size:  42.5 KB
If I use very similar code in VB6 statement for Size and Bold work, the lines containing ColorIndex assignment and Underline do not work, produce errors:
Name:  Error.jpg
Views: 432
Size:  49.1 KB

How do I set the color of text and some other properties of font in Word in VB6?

Thank you