Simple Active X question. 
Author Message
 Simple Active X question.

I'm trying to create a document for my dad that would
allow him to type the customers name once into a textbox
at the top of the document.  

How would I think insert that name automatically into
several places in the document?  Is there any simple way
of doing this?  Thanks for any advice. :-)



Mon, 02 Jan 2006 02:41:25 GMT  
 Simple Active X question.
Hi Kevin,

What you should create for him is a template and store that in the Templates
folder.  He should use it by selecting New from the File menu and then
select that template as the basis for the document that he wants to create.

If it is just one item that he wants to enter in this way, the simplest
thing is to have an autonew macro in that template that calls and InputBox
in which he enters the data.  The code in the autonew macro will then create
a Document Variable that will hold the data that was entered into the
InputBox and by means of { DOCVARIABLE } fields that you locate in the
document where you want the data to appear, the date will then appear in the
document.

The code for such a procedure would be

Dim Message, Title, Default
Message = "Enter the Company name."    ' Set prompt.
Title = "Input Company Name"    ' Set title.
Default = ""    ' Set default.
' Display message, title, and default value.
ActiveDocument.Variables("CompanyName").Value = InputBox(Message, Title,
Default)
ActiveDocument.Fields.Update

If there is more than one piece of information, it is better to use a
userform which is a custom dialog to which you can add controls for each of
the pieces of information.

See the article "How to create a Userform" at:

http://www.mvps.org/word/FAQs/Userforms/CreateAUserForm.htm

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 consulting basis.

Hope this helps
Doug Robbins - Word MVP

Quote:
> I'm trying to create a document for my dad that would
> allow him to type the customers name once into a textbox
> at the top of the document.

> How would I think insert that name automatically into
> several places in the document?  Is there any simple way
> of doing this?  Thanks for any advice. :-)



Mon, 02 Jan 2006 07:52:22 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Simple Question: Assigning Icon to an App : Simple Question

2. simple question...what was the source code for this simple custom action (rules wizard)

3. SIMPLE QUESTION : SIMPLE ANSWER?

4. SIMPLE QUESTION : SIMPLE ANSWER?

5. SIMPLE QUESTION, please SIMPLE ANSWER

6. Simple controls and a very simple question

7. SIMPLE SIMPLE ListView Question. Please help

8. Simple Question...simple answer???

9. VB5 Pro Masked Edit control - A simple, simple question

10. HELP! simple question need simple answer

11. Simple simple ADO question

12. HELP! simple question need simple answer

 

 
Powered by phpBB® Forum Software