Using a macro in word

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

When I open a file I would like the file to prompt me for three pieces of
information, name, position, location, and then put those three items at the
top of the page.

How can I do this?
 
Use DocProperty fields in the header. Write a macro called AutoNew that
displays the File Properties dialog, then updates fields.
 
Can you tell me step by step how to do this?

Jezebel said:
Use DocProperty fields in the header. Write a macro called AutoNew that
displays the File Properties dialog, then updates fields.
 
Here are two lower tech ways of making a document open with text prompts.

1. If you are not familiar with macros or programming in VBA you might just
want enter the information you want in an empty document and save the
document as a template. Then when you start word go to File > New > and
seclect the template that contains the information you want.

2. You can also insert the information prompts for the information you want
into Autotext. Then you can automatically insert the text that you want by
typeing the name of the autotext and pressing F3.

If you want true automation, you will have to add a macro as recommended by
Jezebel and Doug.

Jim
 
1. Decide on names for your three pieces of information (eg MyName, etc)

2. Open the template you're going to use for this. Go to File > Properties.
On the Custom tab, define the properties, inserting dummy values (like
'[Name]', '[Position]', etc)

3. In the document, insert DocProperty fields to display the values.
(Inserting fields is well covered in Help.)

4. Write a macro called AutoNew. In the macro, prompt for the three values.
Either use the built-in FileProperties dialog

Application.Run MacroName:="FileProperties"

or create your own form to collect the values you want and set the document
properties

ActiveDocument.CustomDocumentProperties("MyName") = "Abdullah Bulbul Emir"

5. Update fields to refresh the display of the values in the document.

ActiveDocument.PrintPreview
ActiveDocument.ClosePrintPreview
 

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

Back
Top