Hi =?Utf-8?B?YmVhbnNfMjE=?=,
I'm using Word XP, and so will most of the users. The document its self is
to be set up a template for online ordering of books (I work in a college!).
So there are several different fields for example author, title, ISBN number
etc and one of the fields is going to be a link to the where the book is
being ordered from e.g.
http://www.amazon.co.uk/exec/obidos/ASIN/086341463X/qid=1147174340/sr=2-2/ref=sr_2_
1_2/202-8387707-0452612
So to make it easy for other people who are going to be using the form (so
very inexperienced users) it would be better if it got changed to a
hyperlink, or if there could be a button (like I saw on your website

!)
which they could press and then it would follow the link to the website.
Is it possible to do this?
It should be, yes. Let me be sure, though, that I understand: the person filling
out the form is giving "you" (the person who will order the books) a hyperlink for
your administrative procedure. So the person filling out the form doesn't need the
tool, just the person who receives the form? In that case, it won't be a problem if
the macro removes the form field and replaces it with a MacroButton field. Here's
some code that does this on my machine OK
Sub ReplaceFormFieldWithHyperlink()
Dim doc As Word.Document
Dim ffld As Word.FormField
Dim rng As Word.Range
Dim sHyperlink As String
Dim fldHyperlink As Word.Field
Dim fldMacroButton As Word.Field
Set doc = ActiveDocument
Set ffld = doc.FormFields("ffHyperlink")
sHyperlink = ffld.Result
Set rng = ffld.Range
If doc.ProtectionType <> wdNoProtection Then
doc.Unprotect
End If
ffld.Delete
Set fldMacroButton = doc.Fields.Add( _
Range:=rng, Type:=wdFieldEmpty, _
Text:="Macrobutton FollowHyperlink XX", _
PreserveFormatting:=False)
Set rng = fldMacroButton.Code
rng.Find.ClearFormatting
rng.Find.Execute FindText:="XX"
Set fldHyperlink = doc.Fields.Add( _
Range:=rng, Type:=wdFieldHyperlink, _
Text:=sHyperlink, PreserveFormatting:=False)
fldHyperlink.Result.Text = "Test"
doc.Protect Type:=wdAllowOnlyFormFields, Noreset:=True
End Sub
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister
http://www.word.mvps.org
This reply is posted in the Newsgroup; please post any follow question or reply in
the newsgroup and not by e-mail
