S
singeredel
Can anyone please help me with this code. I cannot get the text that is
placed in the reference field to take on the default font of the paragraph
where it is placed via the reference field. It keeps showing up as the font
of the bookmark text.
Dim bBkm As String
Dim bText As String
Dim bIndex As Long
Dim oRng As Range
For bIndex = 1 To 8
bBkm = Choose(bIndex, "ReportDate", "Addressee", "AttentionLine",
"ReferringPhysician", _
"PatientName", "SSN", "ReportTitle", "County")
bText = Choose(bIndex, ReportDate3, Addressee, AttentionLine,
RequestForConsultation, _
PatientName, SSN, ReportTitle, County)
If ActiveDocument.Bookmarks.Exists(bBkm) = False Then
GoTo NextBkm
End If
Set oRng = ActiveDocument.Bookmarks(bBkm).Range
oRng.Text = bText
Select Case bIndex
Case 2 'Addressee
oRng.Font.Bold = True
Case 3 'AttentionLine
If ReportType = "SSI" = True Then
oRng.Font.AllCaps = True
Else:
oRng.Font.Bold = True
End If
Case 4 'RequestForConsultation
oRng.Font.Bold = True
Case 5 'PatientName
If ReportType = "SSI" Then
oRng.Font.Bold = False
Else:
oRng.Font.AllCaps = True
oRng.Font.Bold = True
End If
Case 6 'SSN
If ReportType = "SSI" Then
oRng.Font.Bold = False
oRng.Font.AllCaps = True
ElseIf ReportType = "EDD" Or ReportType = "EDG" Then
oRng.Font.Bold = True
oRng.Font.AllCaps = True
End If
Case 7 'Report Title
oRng.Font.Bold = True
oRng.Font.AllCaps = True
End Select
ActiveDocument.Bookmarks.Add Name:=bBkm, Range:=oRng
NextBkm:
Next
ActiveDocument.Fields.Update
Dim oFld As Field
For Each oFld In ActiveDocument.Fields
oFld.Result.Style = "Default Paragraph Font"
On Error Resume Next
Next
Much Thanks...!!
placed in the reference field to take on the default font of the paragraph
where it is placed via the reference field. It keeps showing up as the font
of the bookmark text.
Dim bBkm As String
Dim bText As String
Dim bIndex As Long
Dim oRng As Range
For bIndex = 1 To 8
bBkm = Choose(bIndex, "ReportDate", "Addressee", "AttentionLine",
"ReferringPhysician", _
"PatientName", "SSN", "ReportTitle", "County")
bText = Choose(bIndex, ReportDate3, Addressee, AttentionLine,
RequestForConsultation, _
PatientName, SSN, ReportTitle, County)
If ActiveDocument.Bookmarks.Exists(bBkm) = False Then
GoTo NextBkm
End If
Set oRng = ActiveDocument.Bookmarks(bBkm).Range
oRng.Text = bText
Select Case bIndex
Case 2 'Addressee
oRng.Font.Bold = True
Case 3 'AttentionLine
If ReportType = "SSI" = True Then
oRng.Font.AllCaps = True
Else:
oRng.Font.Bold = True
End If
Case 4 'RequestForConsultation
oRng.Font.Bold = True
Case 5 'PatientName
If ReportType = "SSI" Then
oRng.Font.Bold = False
Else:
oRng.Font.AllCaps = True
oRng.Font.Bold = True
End If
Case 6 'SSN
If ReportType = "SSI" Then
oRng.Font.Bold = False
oRng.Font.AllCaps = True
ElseIf ReportType = "EDD" Or ReportType = "EDG" Then
oRng.Font.Bold = True
oRng.Font.AllCaps = True
End If
Case 7 'Report Title
oRng.Font.Bold = True
oRng.Font.AllCaps = True
End Select
ActiveDocument.Bookmarks.Add Name:=bBkm, Range:=oRng
NextBkm:
Next
ActiveDocument.Fields.Update
Dim oFld As Field
For Each oFld In ActiveDocument.Fields
oFld.Result.Style = "Default Paragraph Font"
On Error Resume Next
Next
Much Thanks...!!