• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 999
  • Last Modified:

VBA Macro to Prompt User for information

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?
  • 2
2 Solutions
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)
        MsgBox "That's not a valid date!"
    End If

Open in new window

If you're looking to replace text, insert text before after other text, etc, there are some great examples here:

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now