Returns a String that represents the text Microsoft Publisher displays when the page view is set to show field codes. Read-only.
expression.Code
expression Required. An expression that returns one of the objects in the Applies To list.
This example loops through all the fields in the active publication, and then displays a message as to whether the string "www" was found in the code of any of the fields.
Sub FindWWWHyperlinks()
Dim intItem As Integer
Dim intField As Integer
With ActiveDocument.Pages(1).Shapes(1).TextFrame.TextRange.Fields
Do
intItem = intItem + 1
If InStr(1, .Item(intItem).Code, "www") > 0 Then
intField = intField + 1
End If
Loop Until intItem = .Count
End With
If intField > 0 Then
MsgBox "You have " & intField & " World Wide Web " & _
"hyperlinks in your publication."
Else
MsgBox "You have no hyperlink fields in your publication."
End If
End Sub