current date in text field of an input box

  • Thread starter Thread starter tte
  • Start date Start date
T

tte

Hi All

im trying to figure out how to put the current date in the text portion
of an input box... here's the snippet for the input box...

BackUp = InputBox("CONTINUE BACKUP with date shown?" & Chr(13) &
Chr(13) & "TO REPLACE A BACKUP, enter date as ""MMDDYYYY"", no slashes,
and follow instructions.", "ECC Cashout Backup Utility:")

I would like the date to appear automatically in the text field of the
input box as MMDDYYYY (11042003) and I would also like to keep this
field as writeable in case a change has to be made to an old backup.

thanks in advance...
 
one way:

Const csPROMPT As String = _
"CONTINUE BACKUP with date shown?" & _
vbNewLine & vbNewLine & _
"TO REPLACE A BACKUP, enter date as ""MMDDYYYY""" & _
", no slashes, and follow instructions."
Const csTITLE = "ECC Cashout Backup Utility:"

Dim BackUp As Variant
Do
BackUp = Application.InputBox( _
Prompt:=csPROMPT, _
Title:=csTITLE, _
Default:=Format(Date, "mmddyyyy"), _
Type:=2)
If BackUp = False Then Exit Sub 'user pressed cancel
Loop Until Len(BackUp) = 8

You can, and probably should, of course, do more error checking.
 
Back
Top