R
Roger Marrs
I'd like to check a bookmark to see if it contains text ("a--z"). If it
does, then at a different bookmark I want to insert text, if the bookmark
does not contain the matching text, then I want to insert different text at
a third bookmark.
I've tried the following code, which doesn't produce any result.
Dim AttorneyWaiver As String
Dim AttorneyAppointed As String
Dim vAttorney As String
AttorneyWaiver = "Text version one."
AttorneyAppointed = "Text version two, " & vAttorney & ", goes here."
vAttorney = ActiveDocument.Bookmarks("DefenseAttorney").Range.Text
With ActiveDocument.Bookmarks("DefenseAttorney2").Range.Find
.Text = "a--z"
.Wrap = wdFindContinue
If .Execute Then
ActiveDocument.Bookmarks("AttorneyWaiver").Range.InserstAfter
AttorneyWaiver
Else:
ActiveDocument.Bookmarks("AttorneyAppointed").Range.InsertAfter
AttorneyAppointed
End If
End With
does, then at a different bookmark I want to insert text, if the bookmark
does not contain the matching text, then I want to insert different text at
a third bookmark.
I've tried the following code, which doesn't produce any result.
Dim AttorneyWaiver As String
Dim AttorneyAppointed As String
Dim vAttorney As String
AttorneyWaiver = "Text version one."
AttorneyAppointed = "Text version two, " & vAttorney & ", goes here."
vAttorney = ActiveDocument.Bookmarks("DefenseAttorney").Range.Text
With ActiveDocument.Bookmarks("DefenseAttorney2").Range.Find
.Text = "a--z"
.Wrap = wdFindContinue
If .Execute Then
ActiveDocument.Bookmarks("AttorneyWaiver").Range.InserstAfter
AttorneyWaiver
Else:
ActiveDocument.Bookmarks("AttorneyAppointed").Range.InsertAfter
AttorneyAppointed
End If
End With