Below is a snipet of the code I use to delete two bookmarks that I am
populating from Access. I've traced the code and everything is being executed
properly, but spaces and a blank line are appearing in the bookmark locations
when the Word document is constructed. Is there something else I have to do?
MyCheck = IsNull(rs!OrganizationName)
If MyCheck = True Then
objWord.ActiveDocument.Bookmarks("Organization").Delete
Else
.Item("Organization").Range.Text = rs!OrganizationName
End If
MyCheck = IsNull(rs!Title)
If MyCheck = True Then
objWord.ActiveDocument.Bookmarks("Title").Delete
Else
.Item("Title").Range.Text = rs!Title
End If
.Item("City").Range.Text = rs!City
.Item("FirstName").Range.Text = rs!FirstName
.Item("LastName").Range.Text = rs!LastName
Dave Lett - 22 Nov 2004 19:44 GMT
Hi Ron,
All you're doing is deleting the bookmark. If you want to remove the
_contents_ of the bookmark, then you need to delete its range.
objWord.ActiveDocument.Bookmarks("Organization").Range.Delete
This will delete _anything_ within the range of the bookmark.
HTH,
Dave
> Below is a snipet of the code I use to delete two bookmarks that I am
> populating from Access. I've traced the code and everything is being executed
[quoted text clipped - 16 lines]
> .Item("FirstName").Range.Text = rs!FirstName
> .Item("LastName").Range.Text = rs!LastName