Using "Ask" Macros.

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

Guest

Hello. I am very new to Word, I am trying to make a macro that makes a window
pop up asking a user to enter details such as name, address and phone number.
everytime I record the macro the information never goes in the places I want
it too. any help would be great! thanks :-)
 
Mike,

Your document has to have a place to put the information. Here is an
example macro:

Sub AutoNew()

Dim PolicyNum As String
Dim ClientName As String

PolicyNum = InputBox("Enter policy number", "Policy Number", "XXX-XXXX")
ClientName = InputBox("Enter client name", "Client Name", "New Client")
ActiveDocument.Variables("PolicyNum").Value = PolicyNum
ActiveDocument.Variables("ClientName").Value = ClientName
ActiveDocument.Fields.Update

End Sub

This macro creates two variables PolicyNum and ClientName. In your document
you will need a DOCVARIALBE field to display the variable information e.g., {
DOCVARIABLE Policy Num}.

You could simply use an ASK or FILLIN field. See:
http://gregmaxey.mvps.org/Repeating_Data.htm
and the section on User Prompts.
 
Back
Top