Microsoft Office Tutorials and References
In Depth Information
Copying Nested Field Codes as Text
Wrd
Figure 48 – Nested Field Codes Pasted as Text
View the Appendix to learn how to store this procedure
in a Standard module.
Option explicit¶
' * * * * *¶
Function InsertFieldInFieldCode( _¶
ByRef rng As Word.Range, _¶
ByRef szBkm As String, _¶
ByRef szField As String, _¶
Optional ByRef PF As Boolean = False) As Boolean¶
InsertFieldInFieldCode = False¶
With rng.Find¶
.Text = szBkm¶
.Execute¶
If .Found Then¶
ActiveDocument.Fields.Add _¶
Range:=rng, Text:=szField, _¶
PreserveFormatting:=PF¶
InsertFieldInFieldCode = True¶
End If¶
End With¶
End Function¶
' * * * * *¶
Sub PasteFieldCodesAsText()¶
'Variable declaration¶
Dim rng As Word.Range¶
Dim FieldString As String¶
Dim NewString As String¶
Search JabSto ::




Custom Search