Word Bookmarks 
Author Message
 Word Bookmarks

I have the name of a bookmark in the variable "b" which is dimensioned  as
bookmark.  Is there a way I can call a subroutine which has the same name as
the bookmark whose name in "b"? My documentation talks about variants but no
pointers..

--
Bob Lohse



Sat, 05 Jun 2004 02:50:14 GMT  
 Word Bookmarks
You can call a subroutine using the value of a bookmark with something like
the following:
Sub FirstTest ()
Dim b As Bookmark
Dim sName As String
For Each b In ActiveDocument.Bookmarks
    sName = b.Name
    Application.Run sName
Next b
End Sub

Sub SecondTest()
Beep
End Sub

If you run the FirstTest macro and have a bookmark in the activedocument
named "SecondTest" then the macro will beep. Notice that the value being
passed with Application.Run is string variable, not a bookmark. If you
dimension the variable to pass as a bookmark, then VBA will raise an error.

HTH


Quote:
> I have the name of a bookmark in the variable "b" which is dimensioned  as
> bookmark.  Is there a way I can call a subroutine which has the same name
as
> the bookmark whose name in "b"? My documentation talks about variants but
no
> pointers..

> --
> Bob Lohse



Sat, 05 Jun 2004 04:35:46 GMT  
 Word Bookmarks
Hi Bob,

Excuse me for asking, but I can't tell what you want to achieve.
A subroutine called 'b' in your project and an object variable (dim'd as
bookmark)
named 'b' ??

If they're residing in the same routine, VBA won't even let you pass instant
compilation ...
Why not name the subroutine differently ?? Or the object variable ??

I think you will need to elaborate some more on what it is you want to
achieve.

Kind regards,
Perry



Quote:
> I have the name of a bookmark in the variable "b" which is dimensioned  as
> bookmark.  Is there a way I can call a subroutine which has the same name
as
> the bookmark whose name in "b"? My documentation talks about variants but
no
> pointers..

> --
> Bob Lohse



Wed, 16 Jun 2004 10:09:31 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Import Data from word bookmarks using sql?

2. Go to Word Bookmark

3. WORD bookmark not printing VB text only on some PC's

4. Updating word bookmarks

5. Please help with text box to Word bookmark problem

6. Word - Bookmarks

7. Word Bookmarks, Userforms and Updates

8. word bookmarks

9. word bookmarks

10. Please help with text box to word bookmark

11. Converting Word BookMarks to PDF Files

12. copy an excel chart to word bookmark in vb

 

 
Powered by phpBB® Forum Software