T
Tarjei T. Jensen
I keep getting "Type mismatch" error on xfield_list_Object(bookRange) below.
I'm completely at a loss understanding why this should be so. After all the
xfield_list_Object procedure expects a range object.
I'm sure that there is something I have overlooked, but I can't find what.
Suggestions welcome!
---- code listing ----
Private Sub Set_Bookmark_Text(theName As String, theContent As String)
Dim bookMK As Bookmark
Dim bookRange As Range
Dim bookName As String
Dim rng As Range
[snip]
For Each bookMK In ActiveDocument.Bookmarks
Set bookRange = bookMK.Range
bookName = bookMK.Name
[snip]
ElseIf ActiveDocument.Bookmarks.Exists(theName) Then
xfield_list_Object (bookRange) ' <------ type mismatch
bookRange.Text = theContent
ActiveDocument.Bookmarks.Add bookName, bookRange
Debug.Print " bookmark re-set"
Exit For
End If
'Debug.Print " next bookMK"
Next bookMK
End If
Debug.Print "exit set_Bookmark_Text " & theName
End Sub
Private Sub xfield_list_Object(objbk As Range)
Dim fld As FormField
Dim fld2 As Field
Debug.Print "enter field_list_object"
For Each fld In objbk.FormFields
Debug.Print " formfield::" & fld.Name & ":: " & fld.Type & " " &
fld.Creator
Next fld
For Each fld2 In objbk.Fields
Debug.Print " field ::" & fld2.Type & ":: " & fld2.Kind
Next fld2
Debug.Print "exit field_list_object"
End Sub
I'm completely at a loss understanding why this should be so. After all the
xfield_list_Object procedure expects a range object.
I'm sure that there is something I have overlooked, but I can't find what.
Suggestions welcome!
---- code listing ----
Private Sub Set_Bookmark_Text(theName As String, theContent As String)
Dim bookMK As Bookmark
Dim bookRange As Range
Dim bookName As String
Dim rng As Range
[snip]
For Each bookMK In ActiveDocument.Bookmarks
Set bookRange = bookMK.Range
bookName = bookMK.Name
[snip]
ElseIf ActiveDocument.Bookmarks.Exists(theName) Then
xfield_list_Object (bookRange) ' <------ type mismatch
bookRange.Text = theContent
ActiveDocument.Bookmarks.Add bookName, bookRange
Debug.Print " bookmark re-set"
Exit For
End If
'Debug.Print " next bookMK"
Next bookMK
End If
Debug.Print "exit set_Bookmark_Text " & theName
End Sub
Private Sub xfield_list_Object(objbk As Range)
Dim fld As FormField
Dim fld2 As Field
Debug.Print "enter field_list_object"
For Each fld In objbk.FormFields
Debug.Print " formfield::" & fld.Name & ":: " & fld.Type & " " &
fld.Creator
Next fld
For Each fld2 In objbk.Fields
Debug.Print " field ::" & fld2.Type & ":: " & fld2.Kind
Next fld2
Debug.Print "exit field_list_object"
End Sub