MacroButton field doesn't start macro

G

Guest

I have a text field at the beginning of a Word document which I have
bookmarked. I have recorded a macro using 'Edit-go to' to jump to the field.
The macro works when I run it fromt the tools-macro menu.

However, when I create a MacroButton field {macroButton GoToContentsPage
double-click here}, protect the form, and then double click, the cursor jumps
to what appears to be a random field (it has a bookmark, but nothing like the
GoToContentsPage one).

I am baffled - can anyone suggest what I might be doing wrong?

Many thanks
D
 
G

Graham Mayor

What's the macrobutton field for? An autonew macro in the form template will
take you to any form field in the document of your choice eg

Sub AutoNew()
Selection.GoTo What:=wdGoToBookmark, Name:="Text2"
End Sub

will go to the form field Text2


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
G

Guest

The document is a prtotected Word form (which users fill in), 10 pages long,
and I want to jump from the bottom of each page back to the first page (the
contents page) and also from the first page to each of the other pages.

I am not used to writing macros, so I'm not quite sure what to do with the
information you've so kindly given me???

Many, many thanks for replying.
 
G

Graham Mayor

In the absence of enough information as to why you need to jump around a
form in this manner, then the answer would be to create a series of macros
to jump where you want and add them to a custom toolbar on the form. Sample
macros might include:

Sub gPage3() 'jump to page 3
Selection.GoTo What:=wdGoToPage, Name:="3"
End Sub

Sub gStart() 'go to the start
Selection.HomeKey Unit:=wdStory
End Sub

Sub gText2() 'jump to form field Text2
Selection.GoTo What:=wdGoToBookmark, Name:="Text2"
End Sub

You can either run these from the toolbar buttons or on exit from form
fields as appropriate.

See http://www.gmayor.com/installing_macro.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
G

Guest

The form has several distinct sections that users fill in, and in some cases
don't need to fill them all in. The jump back to the first page (contents
page) is to help them go back to the section that they do need to fill in. I
have put a 'hyperlink' at the bottom of each page which says 'go back to
contents page'

Likewise, I would like them to be able to click on the section title on the
contents page and then use the 'hyperlink' to jump to the first field in the
relevant section.

Does this help, or would it be better to attach the document?

Many thanks again.
 
G

Graham Mayor

You can mail the document to the link on my web site home page and I will
have a look at it over the weekend if you wish.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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