Pause and input

S

Sharon

I want to create a macro that pauses at a certain spot and allows me to enter
in a unique number and then continue the macro.

It appears as if I am not the only one that is trying to do this as
evidenced by the questions in the discussion group, but I am not
understanding why this is so difficult. I believe the the old versions of
Word did this (or was it WordPerfect)? Anyway, I can think of a million
times that this would have been the best way to generate a form. For
instance, run the macro (pause and enter info), continue to run macro (pause
and enter other infor) continue to run macro, etc.

Maybe a macro is not the place to do that, but I personally don't like the
form fields in Word and would prefer to automatically generate the document
from a macro. For example, I have a template letter to a client, I would
like to fire a macro and have it generate the letterhead information, pause
and ask me to input a name (which is in turn tied to another macro?),
continue with the letter and pause and ask for a certain date for example to
be inputted, continue with the rest of the letter and then pause for
insertion of the person who is signing the letter and then complete the rest
of the information for the letter.

Any ideas?

Thanks.
 
E

Ed

Hi, Sharon.

Sharon said:
I want to create a macro that pauses at a certain spot and allows me to enter
in a unique number and then continue the macro.
For example, I have a template letter to a client, I would
like to fire a macro and have it generate the letterhead information, pause
and ask me to input a name (which is in turn tied to another macro?),
continue with the letter and pause and ask for a certain date for example to
be inputted, continue with the rest of the letter and then pause for
insertion of the person who is signing the letter and then complete the rest
of the information for the letter.

At its most basic, one of the easiest ways to do this is to insert an
InputBox at the appropriate points in your code.
It appears as if I am not the only one that is trying to do this as
evidenced by the questions in the discussion group, but I am not
understanding why this is so difficult.
Maybe a macro is not the place to do that, but I personally don't like the
form fields in Word and would prefer to automatically generate the document
from a macro.

That's part of the reason why so many people find this difficult: Word
works *this* way, but people wish it to work *that* way. It's the same with
a lot of things - features and functions vary.

For other "pause and input" situations, you can call a modeless UserForm
whose "Continue" button closes the form and continues the macro.

HTH
Ed
 
J

Jay Freedman

Ed said:
Hi, Sharon.




At its most basic, one of the easiest ways to do this is to insert an
InputBox at the appropriate points in your code.



That's part of the reason why so many people find this difficult:
Word works *this* way, but people wish it to work *that* way. It's
the same with a lot of things - features and functions vary.

For other "pause and input" situations, you can call a modeless
UserForm whose "Continue" button closes the form and continues the
macro.

HTH
Ed

Another method -- the one most "in tune" with the way Word works -- is to
display a single UserForm (or a series of them) that gathers all the
information needed to create the letter. When the user clicks the OK button,
each piece of information from the UserForm is inserted at a predefined
place (bookmark, form field, or other place) in the body of the letter,
which is a copy of the body of the template. The code that does this job can
also validate the data, format it, save it for later use, and a number of
other useful things.

See these articles to get started:

http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm
http://www.dragondrop.com/wordcoding/word011a.asp
 
S

Sharon

Thanks Jay! :O) I am printing the articles right now! I always appreciate
new ideas and faster ways to do things! Thanks.

Right now I am using an Access database with fields to populate a form.
That works great when you have a lot of documents, but when you are only
doing one form and it only has a couple of fields, it sometimes seems as if
it would be easier than opening the database, choosing the record from a
receipient list etc. . . .
 
D

Doug Robbins

12 steps = 1 stride

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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