Hyperlink in Protected Form - Prior MVP help not working

G

Guest

I have read through most of the prior postings regarding this, and followed
the instructions on this document:

http://word.mvps.org/FAQs/TblsFldsFms/HLinksInForms.htm

However, when I double-click the link in my re-protected form, after
creating the macro, it only takes me to the next field on the form, rather
than to the Excel spreadsheet is linked to.

Can someone please help me figure out what I'm doing wrong?
 
J

Jay Freedman

Rachael said:
I have read through most of the prior postings regarding this, and
followed the instructions on this document:

http://word.mvps.org/FAQs/TblsFldsFms/HLinksInForms.htm

However, when I double-click the link in my re-protected form, after
creating the macro, it only takes me to the next field on the form,
rather than to the Excel spreadsheet is linked to.

Can someone please help me figure out what I'm doing wrong?

Add the AutoExec macro (under the "Double-click or single-click" heading in
the article) to your template, so you can single-click the link.

The problem is that when you have to double-click the MacroButton field, the
first of the two clicks forces the cursor out of the protected area and into
the next form field. The second click never takes effect. (This may have
worked differently in an earlier version of Word, or when computers were a
bit slower.)

You can ignore the discussion of the DocumentChange event that follows the
AutoExec macro. I don't see any point in having some documents respond to
single clicks and others to double clicks.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
G

Guest

I created the AutoExec macro, but I am too novice to know how to incorporate
the Global Template piece of this.

Can you help?
 
J

Jay Freedman

You can put the macro into a module in the Normal.dot template. Follow these
steps:

- Open the VBA editor. If you don't see the Project pane on the left, click
View > Project Explorer.
- Click the Normal icon in the Project pane.
- Click Insert > Module.
- Paste the macro code into the editing pane on the right.
- Click File > Save.
- Close the VBA editor, then restart Word. The macro will run each time you
start Word, and it will set the MacroButton fields to respond to single
clicks.

(Short, unnecessary explanation: The Normal.dot template is both a "global
template" that's available to all documents, and a "regular" template that
can be the base for new documents. You can make other global templates by
storing them in the Startup folder, but you don't have to have any.)

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
G

Guest

I did this, and the single click on the link is still carrying the cursor to
the next line of the form. I am pasting below the code in both of the macros.
Maybe you'll see something I'm missing:

FROM THE NEWLY ADDED MODULE FROM YOUR MOST RECENT INSTRUCTION:

Sub AutoExec()
Options.ButtonFieldClicks = 1
End Sub


FROM THE NORMAL TEMPLATE ITSELF:

Sub FollowLink()
'Selection.Hyperlinks(1).Follow
End Sub
Sub AutoExec()
'Options.ButtonFieldClicks=1
End Sub

FROM THE DOCUMENT ITSELF:

Sub FollowLink()
'Selection.Hyperlinks(1).Follow
End Sub


FROM THE LINK ITSELF:
{MacroButton"FollowLink"{HYPERLINK"Z:\Current Projects\Allens Electronic
Enrollment\Allens Rates.xls"}}

I'm obviously still missing something. I appreciate your patience and
assistance.
Thanks,
Rachael
 
J

Jay Freedman

In the FollowLink macro in the Normal.dot template, remove the single quote
from the beginning of the middle line. That single quote makes the line into
a comment -- that is, just plain text that isn't a macro instruction. So
when you click the macrobutton field, Word runs the FollowLink macro, but
the macro doesn't do anything.

Also, in the macrobutton field, it may not be necessary but it's advisable
to put space characters between the word MacroButton and the name of the
macro, and between the name of the macro and the hyperlink; and a space
character after the word HYPERLINK:

{MacroButton "FollowLink" {HYPERLINK "Z:\Current Projects\Allens Electronic
Enrollment\Allens Rates.xls"}}

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
G

Guest

I have done this, but now I am getting a run time error when I double-click
the link:

Run-time error 4198
Command failed

Ideas?
Rachael
 
J

Jay Freedman

You've gotten tangled up beyond my ability to diagnose it
long-distance. If you don't mind emailing the template and document to
me, I'll take a look. Click my name where it says "By:" to get my
address.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 

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