Hello friends
I am using office 2007
I use a code to automate creation of employee contracts using a word template.
I want to add formatting to the information inserted like bold, italics, etc
Here is the part of the code where information is inserted from the record set
I have tried adding
But it is not working
Any suggestions?
Ronald
I am using office 2007
I use a code to automate creation of employee contracts using a word template.
I want to add formatting to the information inserted like bold, italics, etc
Here is the part of the code where information is inserted from the record set
Code:
With wrdDoc
.Bookmarks("Post").Range.Text = rst!PositionTitle
.Bookmarks("Name").Range.Text = rst!Name
.Bookmarks("Name1").Range.Text = rst!Name
.Bookmarks("Name2").Range.Text = rst!Name
.Bookmarks("Post1").Range.Text = rst!PositionTitle
.Bookmarks("Post2").Range.Text = rst!PositionTitle
.Bookmarks("Period").Range.Text = rst!Period
.Bookmarks("Date").Range.Text = rst!StartDate
.Bookmarks("Scale").Range.Text = rst!Scale
.Bookmarks("Salary").Range.Text = Format(rst!BasicPay, "Currency")
'Save Document
strFilePath = CurrentProject.Path & "\" & "Contracts" & "\"
If Len(Dir(strFilePath, vbDirectory)) = 0 Then
MkDir strFilePath
End If
strName = strFilePath & rst!Name & ".docx"
.SaveAs (strName)
.Close
End With
Set wrdDoc = Nothing
rst.MoveNext
Loop
Code:
For Each varBookmark In wrdDoc.Bookmarks
varBookmark.Range.Font.Bold = True
Next varBookmark
Any suggestions?
Ronald