Solved

VBA Macro to Prompt User for information

Posted on 2009-05-20
3
955 Views
Last Modified: 2012-05-07
I want to prompt a user for a date entry, and then insert the date variable into the active Word document.  How can I set this up?  Do you have any examples I can reference?
0
Comment
Question by:cmp119
  • 2
3 Comments
 
LVL 13

Accepted Solution

by:
usachrisk1983 earned 250 total points
ID: 24432346
Here is some VBA that will prompt for a date, validate it, and then enter it wherever the cursor is.

    sDate = InputBox("Please Enter a Date", "Date Prompt")
    
    If IsDate(sDate) Then
        Selection.TypeText (sDate)
    Else
        MsgBox "That's not a valid date!"
    End If

Open in new window

0
 
LVL 13

Assisted Solution

by:usachrisk1983
usachrisk1983 earned 250 total points
ID: 24432355
If you're looking to replace text, insert text before after other text, etc, there are some great examples here:

http://support.microsoft.com/kb/212682
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show, step by step, how to integrate R code into a R Sweave document
A short article about problems I had with the new location API and permissions in Marshmallow
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question