RPrinceton
Programmer
Hello Everyone,
I am using Word Object Library 9.0. This code is executed from within VB6.
I have four lines of Word content. The following block of code is designed to "bold" the first line of the content while keeping the remaining three lines "non-bolded".
The problem is this. The first iteration yields the desired results i.e., the first line is bold and the remaining three normal. The Word doc is visible. The next thing I do is shutdown Word via the 'X' in the corner of the window, not saving the doc. I then re-execute the same code but this time ALL lines are bolded. I do set the Word objects to nothing between each iteration.
Please advise. Thx in advance.
Regards,
RPrinceton
Code snippet:
Set objRng = .ActiveDocument.Range(ActiveDocument.Sentences(1).Start, ActiveDocument.Sentences(1).End)
With objRng
.Bold = True
.Font.Name = "New Times Roman"
End With
Set objRng = .ActiveDocument.Range(ActiveDocument.Sentences(2).Start, ActiveDocument.Sentences(4).End)
With objRng
.Font.Name = "New Times Roman"
End With
I am using Word Object Library 9.0. This code is executed from within VB6.
I have four lines of Word content. The following block of code is designed to "bold" the first line of the content while keeping the remaining three lines "non-bolded".
The problem is this. The first iteration yields the desired results i.e., the first line is bold and the remaining three normal. The Word doc is visible. The next thing I do is shutdown Word via the 'X' in the corner of the window, not saving the doc. I then re-execute the same code but this time ALL lines are bolded. I do set the Word objects to nothing between each iteration.
Please advise. Thx in advance.
Regards,
RPrinceton
Code snippet:
Set objRng = .ActiveDocument.Range(ActiveDocument.Sentences(1).Start, ActiveDocument.Sentences(1).End)
With objRng
.Bold = True
.Font.Name = "New Times Roman"
End With
Set objRng = .ActiveDocument.Range(ActiveDocument.Sentences(2).Start, ActiveDocument.Sentences(4).End)
With objRng
.Font.Name = "New Times Roman"
End With