Input Box as Parameter for report
And I think that depends on what your windows date settings are.
I got January 2, 2003 with "1 2 3" and my USA settings.
I like this a little better:
Option Explicit
Sub carlee2()
Dim d As long
d = Application.InputBox("enter date: ", Type:=1)
If Year(d) < 2000 _
Or Year(d) 2010 Then
MsgBox "quitting"
Exit Sub
End If
Debug.Print d & vblf & format(d,"mmmm d, yyyy")
End Sub
Checking for the date for a valid year can eliminate some of the problems.
Helmut Weber wrote:
Hi Gary
Sub carlee()
Dim d As Date
d = DateValue(Application.InputBox("enter date: ", 2))
End Sub
This allows a lot of options for the user, but still gets a date.
yes, but that is as well the drawback of it
if possible anyhow, it converts the input into a date
For input "1 2 3" it returns "2001-02-03"
For input "1 20 30" it returns "1930-01-20"
For input "9999 1 1" it returns "9999-01-01"
For input "1 1 9999" it returns "9999-01-01" as well
--
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
--
Dave Peterson
|