Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2004

Tip: Looking for answers? Try searching our database.

Deleting Bookmarks Part II

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ron - 22 Nov 2004 17:41 GMT
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

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.