View Single Post
  #6   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman
 
Posts: n/a
Default Drop Down Menus Items Displaying Specific Content

For #1, the "other fields" on your form should be actual form fields,
inserted from the Forms toolbar. The principle is that once the form is
protected, _only_ form fields (text fields, dropdowns, or check boxes) are
editable. Everything else is ... protected.

For #2, the answer is no, the fields can't be made to update immediately
when something is selected in the dropdown. The reason is that the macro
that fills the other fields is an "exit macro" -- Word runs it only when the
cursor exits from the dropdown.

There is an alternative that would solve both problems, but it's a bit more
complicated. Using VBA, you can create a custom dialog (Word calls it a
UserForm, which is a terribly confusing term). There's a short tutorial
about it at http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm.

The macro that makes the dialog appear can be an AutoNew macro that runs
automatically when a new document is created from the template, or it can be
a regular macro started by a MacroButton field or a toolbar button. The
dialog would contain the list of people, and it could also show the other
data (which could update immediately, because a list in a UserForm behaves
better than a dropdown form field). When you're satisfied with the
selection, you click the OK button, and the code in the UserForm drops the
selected data into bookmarks in the document. The document doesn't have to
be protected, so there's no messing with form fields.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

trailerparkboy wrote:
That's excellent. Thank you.
I managed to get the drop down menu and related fields to display on
my own form. Now I just have two questions:

1) When I open the form, do I always have to click on the 'protect
form' padlock and then select the name from the drop down list? And
then deselect it so I can fill in other fields in my form? The drop
down list doesn't work unless I click on the padlock correct? Maybe
I'm not doing something right here.

2) After selecting from the drop down, I have to hit 'Tab' for the
fields to display the corresponding information for that item. Is it
possible to have these fields filled in as soon as I click on the
menu item, so I don't have to hit 'Tab'.

Thanks!



"Jay Freedman" wrote:

OK, for this you will need a macro, and you're correct that a working
example is really the only way to show how to do it.

Download http://jay-freedman.info/sampleform.zip and unzip the
template inside it into your Word Templates folder (the location is
shown in the Tools Options File Locations dialog). Then use File
New to create a document based on the template. The top of the

page is the working form, and the bottom part explains how it works.

To adapt the template for your use:
- Use the File Open dialog, navigate to the Templates folder, and
open the template itself (rather than a document based on it).
- Click the lock icon on the Forms toolbar to unlock it.
- Move the fields around, change the text, add new fields, etc.
- If you change the names of the fields involved in the automatic
filling, you'll also have to change those names in the last few lines
of the macro.
- Put the correct data into the macro. [Note: The names listed in the
macro aren't actually used for anything; they're there to remind you
of the order to place the other data in. The names used in the form
are stored in the dropdown field, not in the macro.]
- Click the lock icon again to turn it on.
- Save the template.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On Mon, 15 May 2006 15:01:01 -0700, trailerparkboy
wrote:

Thanks for your quick reply. I have checked those links and try and
determine what works best for me in this situation.

To answer your questions and be more specific, basically I have a
Word template that has some text fields. On this form there is a
drop down menu with the names of 3 people. When someone selects one
of those names, a few other fields will auto-populate with
information specific to that person (ie their e-mail address,
title, etc.)

The user won't need to modify the results. They should be able to
select a different person for a different result. People will be
saving this document, printing it, or e-mailing it.

If I had a simple sample document of this in action, that would be
ideal, so I could modify it to my needs. I did some searching in
this forum and found some info on adding a macro, but I'm worried
it would take me too long to get it working.

Thanks!

"Jay Freedman" wrote:

I'm not quite clear on what kind of 'content' you want, but you
might be looking for an AutoTextList field
(http://www.word.mvps.org/FAQs/TblsFl...toTextList.htm).

If that isn't it, maybe it's something like this:
http://gregmaxey.mvps.org/Toggle_Data_Display.htm

If I still haven't hit it, try explaining with a more specific
example of how you want the document to work. What phrases should
be in the dropdown (or maybe some other kind of list would do),
and what sort of 'content' should be in the text box or field (or,
again, something else may be appropriate)? After the content
appears, should the user be able to modify it? Should they be able
to pick something else in the dropdown if they don't like the
result? What should be the ultimate use of the document (printing,
emailing, extracting the results into a database, etc.)?

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On Mon, 15 May 2006 14:06:02 -0700, trailerparkboy
wrote:

Hello,
Is it possible to have a drop down menu in Word, and then
depending on which item the user selects, only content specific
to that item is displayed in a text box or field???

Thanks!

Let me know if I'm not making sense.