Making a title bold via VB6 then continuing in non-bold for the text

Experts,

Really simple - i want my title bold in a report i am autogenerating in word from a vb app.

Why isn't the below code working?:

Set appWord = CreateObject("Word.Application")
Set wrdDoc = appWord.Documents.Add
    wrdDoc.Sections.PageSetup.Orientation = Word.WdOrientation.wdOrientPortrait
Set oDoc = appWord.ActiveDocument
With appWord
   .WindowState = Word.WdWindowState.wdWindowStateMaximize
   Set wordRng = wrdDoc.Range
End With
wordRng.Font.Bold = True
wordRng.Font.Underline = wdUnderlineSingle
wordRng.Font.Size = 10

strPrint = "Time Sheet and Working Time Directive" & vbCrLf
wordRng.InsertAfter strPrint
wordRng.Font.Bold = False
wordRng.Font.Underline = wdUnderlineNone

Everything comes up times new roman size 10 but nothing in bold!

Thanks for your time experts!
MattAllenAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rettiseertCommented:
Hi, you are setting the Font.Bold=False for the whole range, try this:

    Set appword = CreateObject("Word.Application")
   
    Set wrdDoc = appword.Documents.Add
        wrdDoc.Sections.PageSetup.Orientation = Word.WdOrientation.wdOrientPortrait
    Set oDoc = appword.ActiveDocument
    With appword
       .WindowState = Word.WdWindowState.wdWindowStateMaximize
       Set wordRng = wrdDoc.Range
    End With
    wordRng.Font.Bold = True
    wordRng.Font.Underline = wdUnderlineSingle
    wordRng.Font.Size = 10
   
    strPrint = "Time Sheet and Working Time Directive" & vbCrLf
    wordRng.InsertAfter strPrint
   
    Set wordRng = wrdDoc.Range(wrdDoc.Characters.Count - 1)
   
    wordRng.Font.Bold = False
    wordRng.Font.Underline = wdUnderlineNone
   
    wordRng.InsertAfter "TEST"
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MattAllenAuthor Commented:
Ahh so i have to keep re-setting the range every time i want to change a row / section / word to italic/bold/underlined/size etc.  Great stuff thanks!!
Cheers
Matt
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.