Hyperlink macrobutton in a protected form document

E

Elizabeth

I followed the MVP site instructions for getting a
hyperlink to work in a document protected for forms, but
get an error message that says "DisplayText cannot span
more than one line!"

{Macrobutton FollowLink "Text to
display"{HYPERLINK "M:\Controls\Usage Records
records\Calibrated Equipment.xls"}

Does anyone know what I'm doing wrong?
 
J

Jay Freedman

Elizabeth said:
I followed the MVP site instructions for getting a
hyperlink to work in a document protected for forms, but
get an error message that says "DisplayText cannot span
more than one line!"

{Macrobutton FollowLink "Text to
display"{HYPERLINK "M:\Controls\Usage Records
records\Calibrated Equipment.xls"}

Does anyone know what I'm doing wrong?

First, remove the part of the field code that says "Text to display" --
that's unnecessary, and it's making the display text too long. Then update
the field (press F9) and the field should display the hyperlink.

It's true that a macrobutton field can't display text on more than one line,
and this could cause a problem if the path to the file or web page is longer
than Word's line length. If it's only a little too long, you can fiddle with
the paragraph indents to give it more room, or you can reduce the font size.
 
E

Elizabeth

Thank you, Jay. I had our MIS department shorten the
folder name on our network. However, I do not want the
path name to display in the form - I just want the user to
see something like "Equipment List". The MacroButton
command on its own allows you to specify the text to
display, but I can't work out how to get the setting right
with the MacroButton and Hyperlink combined. Any
suggestions?

Cheers,
Elizabeth
 
J

Jay Freedman

Hi Elizabeth,

Yes, you can do this, indirectly.

Although a hyperlink is represented in a document as a field, it's actually
a more complex object. It has separate storage for the displayed text and
the destination address. When you create a hyperlink field by typing its
code, you're directly setting the destination address and Word makes the
display text equal to that string. When you use the Insert > Hyperlink
dialog, though, you can enter different display text. That's what will show
when you nest the hyperlink inside a macro button field.

For existing macrobuttons, edit them as follows, after temporarily turning
off protection: Click once on the macrobutton and press Shift+F9 to open the
field code. Right-click the hyperlink and select Edit Hyperlink. Change the
"Text to display" box to the short form. Click OK, then press F9 to update
the field. If you look again at the field code, the hyperlink field still
shows the full path, but collapsing it will show the display text.

For new links, insert the hyperlink first with the dialog, and set the
display text there. Then type the "Macrobutton FollowLink" keywords to its
left, select it all, and press Ctrl+F9 and then F9.

With this change, it no longer matters how long the actual path is (but I
think it may be truncated in the hyperlink if you exceed 255 characters).
 

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