Creating a Userform upon Opening Doc

J

Joe Bloggs

Hi all,

I'm totally new to doing this sort of thing so please treat me as a
beginner.

Basically, I want to create a document / template using MS Word that will be
given to various users. The document will contain a page of text with gaps
throughout the text that I want to be filled in with users replies.

When the document / template is opened, I want a pop-up form to appear. I
want it to contain the following questions:

1.) What is your name? (with a space to enter name)
2.) Sex of person - male or female? (tick box)
3.) Christian name of person?
4.) Surname of person?
5.) Items Purchased

Now once all this info is entered, I want for the user to be able to click
ok then the form to be populated with their replies. With number 2 (sex of
subject, I want it to appear throughout the document, ie referring to
somebody as 'he' or 'she' depending on what sex has been chosen. Likewise, I
would need the surname of the person to be repeated at various places
throughout the document.

Can anybody offer me any guidance?

Thanks in advance
 
C

Cindy M -WordMVP-

Hi Joe,
I'm totally new to doing this sort of thing so please treat me as a
beginner.

Basically, I want to create a document / template using MS Word that will be
given to various users. The document will contain a page of text with gaps
throughout the text that I want to be filled in with users replies.
See this article

http://word.mvps.org/faqs/Userforms/CreateAUserForm.htm

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
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 :)
 
J

Joe Bloggs

Cindy,

Many thanks - managed to get the bookmarks to automatically populate with
the data entered when the template is opened and the form opens.

How do I go about getting one single entry populated throughout the form
though? For example, on the userform, I want the user to be able to select
the sex of a person with a small dot (can't remember the technical term). So
on the form, it will read "Sex of person - male or female" and a dot next to
each word that the user can click. Then depending on what is selected, I
want various bookmarks in the template to populate with the relevant words,
"he" or "she."

Any suggestions?
 
J

Jean-Guy Marcil

Joe Bloggs was telling us:
Joe Bloggs nous racontait que :
Cindy,

Many thanks - managed to get the bookmarks to automatically populate
with the data entered when the template is opened and the form opens.

How do I go about getting one single entry populated throughout the
form though? For example, on the userform, I want the user to be able
to select the sex of a person with a small dot (can't remember the
technical term). So on the form, it will read "Sex of person - male
or female" and a dot next to each word that the user can click. Then
depending on what is selected, I want various bookmarks in the
template to populate with the relevant words, "he" or "she."

Wherever you want he or she, try this:

{IF Gender_Bookmark = "male" "he" "she" }

Where the {} must be entered by doing CTRL-F9, then you can type inside the
braces.
When you are done typing, select the field (the {} are field delimiters)
and hit F9 to update the field and toggle between field code and field
value. Later, if you want to edit the field code, select the field value and
do SHIFT-F9 to access the code again.

The code means:
IF the Bookmark named Gender_Bookmark has the value "male" insert the
text "He" here, otherwise, insert "she".

Of course, replace Gender_Bookmark by your actual bookmark name that
contains the ser answer to the userform reply and "male" by the actual
answer you are inserting.

If, on the other hand, you do not need the actual word "male" or "female" in
the text itself, just the right pronouns (he, she, his, her, etc.) then use
this instead:

In the userform code, you seem to be using option buttons ("with a small
dot"), this code will create a variable stored in the document itself:
If Me.OptionButton1.Value = True Then
ActiveDocument.Variables("userGender").Value = "male"
Else
ActiveDocument.Variables("userGender").Value = "female"
End If

where userGender is the name of the document variable.

Then, in the document:

{IF {DOCVARIABLE userGender}= "male" "he" "she"}

We are allowed to nest fields within other fields.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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