Running an embedded macro in a template.

G

Guest

Is there a way, when creating a template, to have it run a specific macro
based on a users response?

For example, I have 5 choices available from a name field, the user chooses
John Doe. I would then like a macro to run, that will place John Doe's
mailing address into the form (in a specific format). Is this possible? If
so, how would it be done? I would prefer to use a listbox format for the
user interface. Obviously each possible choice would run a different macro.

Thanks in advance for your time.
 
B

Beth Melton

Sure, what you want can be done and you only need a single macro. It just
needs to use a Select Case statement which can determine the ListIndex of
the item selected and run specific code for that item accordingly. You'd
also need to add a Bookmark for the address in the template in order to make
it easy to find the location for the address when the macro runs.

If you need additional help in creating such a macro then you might want to
post further questions to one of the Word VBA newsgroups.

Please post all follow-up questions to the newsgroup. Requests for
assistance by email cannot be acknowledged.

~~~~~~~~~~~~~~~
Beth Melton
Microsoft Office MVP

Coauthor of Word 2007 Inside Out:
http://www.microsoft.com/MSPress/books/9801.aspx#AboutTheBook

Word FAQ: http://mvps.org/word
TechTrax eZine: http://mousetrax.com/techtrax/
MVP FAQ site: http://mvps.org/
 
G

Guest

That sounds very interesting. Any particular newsgroup I should post a
followup question in regards to this? This sounds promising.
 
B

Beth Melton

It looks like this one, Word Programming, is the only one available from the
Microsoft site:
http://www.microsoft.com/office/com...crosoft.public.word.vba.general&lang=en&cr=US

Please post all follow-up questions to the newsgroup. Requests for
assistance by email cannot be acknowledged.

~~~~~~~~~~~~~~~
Beth Melton
Microsoft Office MVP

Coauthor of Word 2007 Inside Out:
http://www.microsoft.com/MSPress/books/9801.aspx#AboutTheBook

Word FAQ: http://mvps.org/word
TechTrax eZine: http://mousetrax.com/techtrax/
MVP FAQ site: http://mvps.org/
 
G

Guest

Beth, I appreciate your help! Thank you much!

Beth Melton said:
It looks like this one, Word Programming, is the only one available from the
Microsoft site:
http://www.microsoft.com/office/com...crosoft.public.word.vba.general&lang=en&cr=US

Please post all follow-up questions to the newsgroup. Requests for
assistance by email cannot be acknowledged.

~~~~~~~~~~~~~~~
Beth Melton
Microsoft Office MVP

Coauthor of Word 2007 Inside Out:
http://www.microsoft.com/MSPress/books/9801.aspx#AboutTheBook

Word FAQ: http://mvps.org/word
TechTrax eZine: http://mousetrax.com/techtrax/
MVP FAQ site: http://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