Populating fields with data

L

Laura Townsend

Greetings,

Does anyone know of a way to fill information into several places in a
document without "Prompting" a user? For example, if I have a letter that
uses the recipients name in several places, can I click a "field" and type
their name at the top of the document, and have that cross referenced to
display at other locations in the document?

A little background -- the person for whom I'm making this letter template
is "afraid" of user forms and wants something "simpler." I could use an ASK
or FILLIN Field, and cross reference the results elsewhere, but that seems
more "complex" to me, since it still PROMPTS the user, and there's more than
one repeating item (like client name, company name, etc.) -- they'll have to
go through multiple prompts. I could use a bookmark around the text they
type, but I'm afraid that will be vulnerable to the user inadvertantly
deleting the bookmark. I don't think a "form" is good, because they'll want
to edit a lot of the text in the letter.

I think I can talk them into the userform, but I want to make sure I'm not
missing some simple/obvious "field" way to do this.

ALSO -- this template will be used on both PC and MAC computers that run
Word (The MAC part makes me nervous as I've never used it and therefore
don't know that it REALLY behaves the same to VBA and Word in general as the
PC's do.)

Thanks so much!
Laura
 
W

Word Heretic

G'day "Laura Townsend" <[email protected]>,

Get the user to properly complete the File > Properties dialog and use
references to that data.

Steve Hudson
Word Heretic Sydney Australia
Tricky stuff with Word or words

Email: WordHeretic at tpg.com.au


Laura Townsend was spinning this yarn:
 
D

Doug Robbins - Word MVP - DELETE UPPERCASE CHARACT

Hi Laura,

The only thing I am not sure about is the Mac part of the problem. If it
wasn't for that, I would say that a userform IS the way to do this.

--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
Doug Robbins - Word MVP
 
W

Word Heretic

G'day "Doug Robbins - Word MVP - DELETE UPPERCASE CHARACTERS FROM
Does anyone know of a way to fill information into several places in a
document without "Prompting" a user?
2.
A little background -- the person for whom I'm making this letter template
is "afraid" of user forms and wants something "simpler."
3.
I think I can talk them into the userform, but I want to make sure I'm not
missing some simple/obvious "field" way to do this.


You missed all 3???

Steve Hudson
Word Heretic Sydney Australia
Tricky stuff with Word or words

Email: WordHeretic at tpg.com.au


Doug Robbins - Word MVP - DELETE UPPERCASE CHARACTERS FROM EMAIL
ADDRESS was spinning this yarn:
 
M

Mark Tangard

Laura,

There surely is "a field way" to do this -- with REF fields and bookmarks. But
it's a zillion times less elegant than a userform, and, as you're aware, fraught
with peril and the constant niggling worry about whether the fields are updated,
the bookmarks accidentally destroyed, etc. In any environment where end users
do extensive editing of the document and where the fields and/or bookmarks are
scattered throughout, I would try hard to avoid a field-based solution.

It sounds to me like your client may not really *know* what a userform is. I've
only rarely seen anyone prefer the non-userform method when presented with both
(assuming it's a task that could justify a userform in the first place). The
task you describe, even without much detail, seems tailor-made for a userform.
Does the client understand you're NOT talking about a "protected-form" document
with shaded fields, ugly checkboxes, etc? Has he or she seen a small but nicely
illustrative demo?

A well-designed userform always feels more *comfortable* ("simpler" if you like)
than most other approaches, for two reasons: First, while active, it takes the
user's eye away from the perhaps-cluttered document window, into a cleaner and
more clearly purposed box, focusing attention on a relatively few items. (Never
underestimate the psychological benefit of a simplified view!) And second, a
userform's design can be *precisely* customized to the task. For example, say
one of the data requested is a 27-digit number that needs to appear in the
document in 8-point type and your end user has really bad eyesight (even worse
than mine...). Just assign a nice big unserifed font for the textbox on the
userform into which the user will type that number, and you'll save a good 2
minutes per iteration -- to say nothing of accuracy, morale, and aspirin.

Another example: Suppose a document requires input from several sources; you
need to look up 22 different names, figures, etc., in 14 different books, files,
and ledgers. But the sequence in which these data must appear in the document
isn't anything like the order in which they're found in the source materials.
Just arrange the input elements in the *form* in the order that most comfortably
matches the source materials, and your code, not your brain, can take care of
putting the data where it needs to be in the document.

Burst Bubble Dept: I've heard from one of our most knowledgeable Mac-experienced
MVPs that userforms are in fact NOT easily interchanged between Windows and Mac
platforms. I don't know the extent of the hassle -- whether you'd need to build
it twice from scratch or just do a bit of adjusting to the graphical elements --
but it's a safe bet that switching won't be seamless. Despite that, I'm still
pretty sure you'd end up with happier users and whatever extra work is involved
would pay off.

For even more hype, see http://www.speakeasy.org/~mtangard/userforms.html
 
B

Bruce Brown

Laura

As an alternative to user form programming, you might consider the
bookmarked AutoTextList field.

It has these advantages:

* Like form fields, it enables you, if desired, to choose from a list
of pre-defined choices by right-clicking the field.

* Unlike form fields, it requires no protection and eliminates the
burdens/sacrifices exacted thereby.

* Most importantly, when bookmarked, the AutoTextList field can be
edited ad infinitum without destroying the bookmark!

Meaning that no matter how often the contents of the AutoTextList
field are changed, neither the bookmark nor the field nor the optional
pre-defined choices will disappear.

Also meaning that the field can be accessed either by pressing F11 or
going to the bookmark.

To repeat a field's contents throughout the doc, simply use REF fields
that reference the bookmark. Since the bookmark is indestructible,
the updated REF fields will never fail. Neat, n'est-ce pas?

First read MVP Bill Coan's article "How to add pop-up lists to any
Word document, so you can click your way through changes in seconds
Or how to use the AutoTextList field"

http://www.mvps.org/word/FAQs/TblsFldsFms/AutoTextListContent.htm.

After creating an AutoTextList field following Bill's simple
instructions, bookmark it using the same name as the field itself,
e.g., Sender, Recipient, FaxNo, TelNo, etc. By setting the field's
initial contents to this name as well, it provides a built-in user
prompt.

Sorting by location makes it easier for the user to go back and find
the field.

Since you'll definitely be using the REF field, you'd probably want to
add simple macros to update all fields before printing or saving a
document. You'd also probably want to have one shortcut key or
toolbar macro to update fields and go to the next field, plus one that
just updates fields. The ActiveDocument.Range.Fields.Update method is
better than Ctrl-a, F9.

Whether or not any of this will work in Word for Mac is an open
question mark. If it does, it may solve your problem without user
forms. - Bruce
 
L

Laura Townsend

Thanks so much,

I've read about the pull down lists you can make w/ auto text but hadn't
thought of a bookemarked auto text. I'll have to play with this and see if
it works for the Macs! (Unless I could just wish them out of existence so I
don't have to deal with them instead!!!)
 
L

Laura Townsend

Hi Doug,

Thanks, as always, for your help!

I think I've almost got him convinced to go w/ the user forms, if he tells
me they behave on his macs. One challenge was that I sent him an example
that contained a line of code I forgot to remove to load settings from a
user profile string (which of course did not exist on his computer). It
errored out and he was convinced the user form "altered" his normal.dot (I'm
convinced that's not possible, but don't want to insult him.) Either way --
not a real confidence builder. And since the macro started with "on error
resume next" I dont' know if he ran it on a mac or what that it errored out.

ANYHOW -- hopefully he'll go for the user form after all and if not I'll
give Mark's bookmarked auto text fields (below) a shot.

I'll report back to the board any findings I have about how the Mac's
behave.


"Doug Robbins - Word MVP - DELETE UPPERCASE CHARACTERS FROM EMAIL ADDRESS"
 
M

Mark Tangard

Laura said:
ANYHOW -- hopefully he'll go for the user form after all and if not I'll
give Mark's bookmarked auto text fields (below) a shot.

Just for the record, that was Bruce's idea, not mine. And it sure sounded like
it would keep everyone happy.
I'll report back to the board any findings I have about how the Mac's
behave.

I'll be extremely interested to hear the specifics of what goes wrong & how hard
it is to fix. TIA.
 
L

Laura Townsend

Hi,

I just tried playing with this and I feel like I'm missing something -- it
seems to only let me choose from an auto text list, or add to the list. In
my case, they will want to type random text (like a company name) that would
not belong to a list -- it would be different each time they used the
template.

Am I missing the big picture here?
Thanks!
 
L

Laura Townsend

Mark,

Thanks for your reply -- my post above (to Doug) was actually intended for
you -- I got you guys mixed up!

Either way, thanks, and I think I can convince them to go w/ the user forms.

Laura
 
B

Bruce Brown

Choices are purely optional with the AutoTextList field.

In fact, it's easier when there are no choices. Just leave the
"Context" box blank when you insert the field through the InsertFields
dialog. The purpose of the "Context" box is to get the style from
which the list of choices is compiled, since AutoText is
style-differentiated. No style, no choices.

Whatever you want the field to read the first time around, put that in
the "New Value" box.

Pressing F11 will take you from field to field. With the field
selected, type in what you want and go to the next one.

Or, go to the bookmark and start typing. Either way works without
pre-defined choices.
 

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