check for existence of bookmark, possible? 
Author Message
 check for existence of bookmark, possible?

I'm trying to check for the existence of a bookmark in any given
document, controlling Word 2000 from Visual Basic 6. Is this
possible?

Right now I use this code to insert text at a bookmark.

  ActiveDocument.Bookmarks("Add1").Range.Text = " Text 1"

I'm thinking of using an array of bookmarks, e.g. BkMk(1 to 10),
then using:

   for n = 1 to 10
     ActiveDocument.Bookmarks(BkMk(n)).Range.Text = Text(n)
   next n

but not every doc holds every bookmark. I could use this
statement:

   On Error continue Next

but I'd rather avoid generating errors.

Any suggestions?



Thu, 15 Jul 2004 02:04:00 GMT  
 check for existence of bookmark, possible?
I found this code:

If ActiveDocument.Bookmarks.Exists("Test") Then
    ' procedures
End If

Quote:

> I'm trying to check for the existence of a bookmark in any given
> document, controlling Word 2000 from Visual Basic 6. Is this
> possible?

> Right now I use this code to insert text at a bookmark.

>   ActiveDocument.Bookmarks("Add1").Range.Text = " Text 1"

> I'm thinking of using an array of bookmarks, e.g. BkMk(1 to 10),
> then using:

>    for n = 1 to 10
>      ActiveDocument.Bookmarks(BkMk(n)).Range.Text = Text(n)
>    next n

> but not every doc holds every bookmark. I could use this
> statement:

>    On Error continue Next

> but I'd rather avoid generating errors.

> Any suggestions?



Thu, 15 Jul 2004 02:14:14 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. A2K Check for Existence of Back End File

2. Checking for Table Existence

3. Check for Existence of Table

4. Check for table existence

5. Check for the Existence of a control.

6. Checking for the existence of remote databases....

7. Check for existence of object?

8. Checking for the existence of a file

9. Check for existence of subdirectory

10. Checking the existence of a table

11. Check for the existence of a field

12. Check for the existence of a field

 

 
Powered by phpBB® Forum Software