Solved

VBA Macro to Prompt User for information

Posted on 2009-05-20
3
951 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
Comment Utility
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
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Office 365 is currently available in five editions. Three of them are for business use: Office 365 Business Essentials, Office 365 Business, and Office 365 Business Premium. Two of them are for home/personal use: Office 365 Home and Office 365 Perso…
In a previous video Micro Tutorial here at Experts Exchange (http://www.experts-exchange.com/videos/1358/How-to-get-a-free-trial-of-Office-365-with-the-Office-2016-desktop-applications.html), I explained how to get a free, one-month trial of Office …

743 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now