Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hyperlink in Text Field of Protected Form

Status
Not open for further replies.

skoutr1

Technical User
Aug 9, 2001
22
US
Is there a way (VBA sollution or otherwise) to allow a user to insert hyperlinks in a text field of a protected MS Word form?
 
Do you mean using the menus (Insert > Hyperlink) to put a hyperlink into a text formfield?

Not without unprotecting. This could be done either manually (using the menu to turn off protecting), or by code with VBA. This is not difficult.

I have to ask why you need this. Why are you putting a hyperlink into a formfield? What are the circumstances that a user would do this?

Gerry
 
This form is to notify coworkers and external entities that they are requested to review documents. The documents will be stored on our servers for internal reviewers, and on an ftp server for external reviewers.

Persons filling out the form include hyperlinks to the respective directories.

Right now, everyone and their brother has their own version of this form. Some are in Word and some are in Excel. I would rather not turn off protection, as this is a new version of the form that is supposed to be consistent.

-Rod
 
I would rather not turn off protection, as this is a new version of the form that is supposed to be consistent. "

Huh? Turning off protection will not do anything to change it being consistent, or at least, it does not have to.

In any case it does not really matter, you are stuck. I can get a hyperlink into a text formfield, and the document remain protected. HOWEVER, a hyperlink in a protected document formfield does not function. You can click on it until the cows come home. It will show you the target, but nothing happens. You can even right-click and select "Open Hyperlink"....it still will not work. Hyperlinks do not work from a protected Sections.

You may want to consider a re-design. I can understand how in the situation you describe using hyperlinks would be a good idea. So...perhaps have it so hyperlinks can be inserted, but NOT in a formfield, or rather, not in a protected Section. If a hyperlink is in a protected-for-forms document, AND it is in a unprotected section - you can use short wee Sections by using Continuous Section breaks - then THOSE hyperlinks will work.

At least in my version of Word (2002). Maybe it works in 2007, I do not know.

Gerry
 
here is the macro you need-

Sub FollowLink()
Selection.Hyperlinks(1).Follow
End Sub
insert hyperlink in the form whenit's unprotected, and press Alt+F9 to display the field codes. u'll see -

{ HYPERLINK " }

highlight the field & press Ctrl+F9, which will nest the hyperlink field inside another field like this:

{ { HYPERLINK " } }

edit the field like this:

{ MacroButton "FollowLink"{ HYPERLINK " }}

if you don't want the field result to show a space after the url add., you need to remove any spaces before and after the nested field.
Press Alt+F9 again to turn the display of field codes off, press (F9) to updated, protect your form and you're done.

Test by double clicking your hyperlink.
 
Except the OP is (AFAIK) not asking/talking about any macrobuttons, but formfields.

skoutr1, could you explain: "Persons filling out the form include hyperlinks to the respective directories." a bit more.

The users are entering URLs - as URLs - into the formfields?

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top