Toolbar Links

A

almazrouei

Dear all,

I'm using Word 2003, I would like to create a toolbar that has links that
can take me to specific tables in my document. is it possible ?
 
J

Jay Freedman

Dear all,

I'm using Word 2003, I would like to create a toolbar that has links that
can take me to specific tables in my document. is it possible ?

It's possible, but not particularly easy. First, you would have to put bookmarks
at the places you want to jump to (presumably either the first or last cell of
the table).

To do what you ask literally, you'd then have to record or write a macro that
goes to the bookmark, something like this:

Sub GoBk1()
Selection.GoTo What:=wdGoToBookmark, Name:="bk1"
End Sub

Make a macro for each bookmark, changing only the macro name and the bookmark
name. Then create a new toolbar, and add a button to run each macro.

This scheme can be simplified a bit if you use VBA to assign the .Tag property
of each button to hold the corresponding bookmark name. Then you can have only
one macro, with all the buttons pointing to the same macro; the code gets the
..Tag value of the button that was clicked and uses that in the GoTo statement.

I think all of this is too much work. Instead, once the bookmarks are in place,
just use the GoTo command (Ctrl+G or Edit > GoTo), click Bookmark in the list on
the left, and choose (or type) the bookmark name in the dropdown on the right.
 
A

almazrouei

Dear Jay,

Thanks for your help,
I really need to have this toolbar in my document because I'm using it
daily, it's like a diary, and I've been using it for years.
I created 9 bookmarks in the beginning of each table, and I created 9 words
in a new custom toolbar. Could you please tell me the code of macro that goes
to the bookmark?
And could you please tell me where and how to put it.
 
S

Suzanne S. Barnhill

Would it perhaps work just as well to use the Document Map, if you assigned
heading styles to text at the beginning of the tables?
 
J

Jay Freedman

Instructions for installing macros are at
http://www.gmayor.com/installing_macro.htm. You can put the macros in your
Normal.dot template or in a module that you create in the document itself
(using the Insert > Module command in the VBA editor).

The code of the macro is what I already showed:

Sub GoBk1()
Selection.GoTo What:=wdGoToBookmark, Name:="bk1"
End Sub

if the bookmark is named bk1. Make a copy of this, and change the macro name
(GoBk1) and the bookmark name in quotes to whatever is the actual name of
one of the bookmarks. Then make another copy and change it to refer to the
second bookmark, and so on until you have 9 macros to match your 9
bookmarks/tables.
 
A

almazrouei

THANK YOU VERY MUCH JAY FREEMAN

EXCELLENT JOB

I MADE IT

BEST REGARDS,
ALMAZROUEI
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top