How do I set up a macro that prompts for input in Word 2002?

X

Xane

I wish to create a macro in Word 2002 that prompts for user input. For
example for someone to enter a postal code. This input should then go to a
certain location in the Word document.
If you can provide me with this info, please contact me at (e-mail address removed).

Thank you.
 
K

Krakmup

G'Day
Public strCode as String

Sub PostCode( )
Dim MessageIn, TitleIn, DefaultIn, MyValueIn
MessageIn = "Enter the Desired Postal Code." ' Set prompt.
TitleIn = "City Postal Code" ' Set title.
DefaultIn = "48082" ' Set default.
' Display message, title, and default value.
MyValueIn = InputBox(MessageIn, TitleIn, DefaultIn, 1600, 1200)
strCode = MyValueIn

'Insert a bookmark inside the document, such as "PostalCode"
'Insert code:
ActiveDocument.Bookmarks("PostalCode").Range.InsertBefore strCode
End Sub

Krakmup
 

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