Hi Matt,
I do apologize for addressing you as Mark before -- that was from
another post I answered just before yours.
You certainly have not started with the easy end of things! Your
requests are quite difficult to satisfy, even with some fancy macro
programming.
The first difficulty is that form fields in protected forms have no
ability to contain either hyperlinks or images. You'll be forced to
program workarounds, or to completely redesign your form.
The second difficulty is that if you want to *replace* the form field
with a hyperlink or image -- as opposed to placing the hyperlink or
image *next to* the form field -- you'll no longer have a field that
you can edit. It would be a use-once form.
The page at
http://word.mvps.org/FAQs/TblsFldsFms/HLinksInForms.htm
explains how to put an unchanging hyperlink into a protected form so
that it can be clicked to follow the link. At the bottom of that page
is a link to
http://word.mvps.org/FAQs/MacrosVBA/NestedFieldsWithVBA.htm, which
explains how to insert the necessary field from a macro. The macro
named "InsertHyperLinkFieldWithinMacroButtonField" in the middle of
that page does it, but only for the constant URL
http://www.mvps.org/word/. You would need to modify the macro in three
important ways: (a) use the content of the form field as the URL to
place in the hyperlink, (b) unprotect the document at the start of the
macro and reprotect it at the end, and (c) move the Selection to a
bookmark outside the original form field so the macro doesn't
overwrite it with the new hyperlink. When the macro creates the
hyperlink, it needs to recreate the bookmark to cover it, so the next
execution of the macro can find it again.
Once that's done, you can go into the form field's Properties dialog
and set the Exit Macro box to point to the macro.
The image field could be either more or less difficult, depending on
your requirements. If there is a reasonably small selection of images
from which the user is forced to choose, you could store the images in
the template as AutoText entries. The form could contain a dropdown
list of the images, and the exit macro of the dropdown would unprotect
the document, select a predefined bookmark, insert an AUTOTEXT field
containing the name of the correct AutoText entry, reapply the
bookmark, update the field, and reprotect the document.
If the form field needs to be edited by the user to the name of an
arbitrary graphic file on their PC (or elsewhere), the macro needs to
be a bit more complex. First, it needs to verify that the named file
actually exists -- that the user hasn't made a typing mistake. Then it
does the same unprotect/get bookmark, inserts an INCLUDEPICTURE field
with the file name, bookmark/reprotect.
You'll find help with some of these tasks by studying the pages at
http://word.mvps.org/FAQs/MacrosVBA/InsertingTextAtBookmark.htm
(reapplying a bookmark),
http://word.mvps.org/FAQs/MacrosVBA/SpellcheckProtectDoc.htm
(unprotecting/reprotecting), and
http://word.mvps.org/FAQs/TblsFldsFms/ValidateFFields.htm (forcing the
user back to the form field if the entry isn't valid).
If you're open to redesigning the whole form, you may actually have an
easier job by learning to design a userform (a custom dialog box).
There's a lot of information about userforms at
http://word.mvps.org/FAQs/Userforms.htm.
Whichever way you decide to go, you can get more help here. If you're
having trouble with macro code, be sure to post the relevant piece of
code as part of your question.
--
Regards,
Jay Freedman
Microsoft Word MVP
Please excuse my newbieness...I seem to have gotten in over my head in
tackling this project, as I've never made a Word template before and
underestimated the complexity of making one. I do appreciate your help...
Further explanation:
I am creating templates based on a few documents. The text portions of these
documents I have converted using Text Form Fields. These fields are tabbable
and the text is editable when the template is locked. What I need to
accomplish is
adding a field that contains a hyperlink in which the text and the url can
be edited when the template is locked
and
adding a field that conains an image which can be changed when the template
is locked
I suppose this might involve the use of macros and other stuff. I've looked
all over and haven't found a solution yet.
Thank you again for attempting to understand me!
Matt