J
jbc
Hi,
I'm trying to automate the process of putting sequential numbers into a
document when the paragraph is normal. The following code is doing exactly
what I need, but I need the fields to be inserted with bold formatting. I've
tried all kinds of combinations, but word is not cooperating.
Dim oPar As Paragraph
Dim oRng As Range
ActiveWindow.View.ShowFieldCodes = True
For Each oPar In ActiveDocument.Paragraphs
If oPar.Style = "Normal" Then
'check if field code is there, if not add it
If Not Mid(oPar.Range.Text, 3, 3) = "SEQ" Then
oPar.Range.InsertBefore vbTab
Set oRng = oPar.Range.Duplicate
ActiveDocument.Fields.Add Range:=oRng, Type:=wdFieldSequence,
Text:= _
"Paragraph \# ""[0000]"" \n "
End If
End If
Next
ActiveWindow.View.ShowFieldCodes = False
ActiveDocument.Fields.Update
Thanks for your help.
jbc
I'm trying to automate the process of putting sequential numbers into a
document when the paragraph is normal. The following code is doing exactly
what I need, but I need the fields to be inserted with bold formatting. I've
tried all kinds of combinations, but word is not cooperating.
Dim oPar As Paragraph
Dim oRng As Range
ActiveWindow.View.ShowFieldCodes = True
For Each oPar In ActiveDocument.Paragraphs
If oPar.Style = "Normal" Then
'check if field code is there, if not add it
If Not Mid(oPar.Range.Text, 3, 3) = "SEQ" Then
oPar.Range.InsertBefore vbTab
Set oRng = oPar.Range.Duplicate
ActiveDocument.Fields.Add Range:=oRng, Type:=wdFieldSequence,
Text:= _
"Paragraph \# ""[0000]"" \n "
End If
End If
Next
ActiveWindow.View.ShowFieldCodes = False
ActiveDocument.Fields.Update
Thanks for your help.
jbc