Link to home
Start Free TrialLog in
Avatar of MattAllen
MattAllen

asked on

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!
ASKER CERTIFIED SOLUTION
Avatar of rettiseert
rettiseert

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 MattAllen
MattAllen

ASKER

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