Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Specify current date in file name

Status
Not open for further replies.

ohmbru

Technical User
Jul 13, 2001
161
US
I transfer a file daily called 'pending.dat'

How can I make the file name reflect the current date:

'pending0710.dat'

Brian
 
Use month and day from now().

MsgBox Weekday(Now())
MsgBox Day(Now())

Just gave me 4 and 10.

Rollie
 
Using just the date would return a part of the filename which could not be used to create a legal filename.

sFilename = "Pending" & Date & ".dat"

?"Pending" & Date & ".dat"
Pending7/10/2002.dat

If you want only the 710 then use a small function to get it.

Public Function GetDatePart() As String
GetDatePart = Month(Date) & Day(Date)
End Function

?Month(Date) & Day(Date)
710




----------------------
scking@arinc.com
Life is filled with lessons.
We are responsible for the
results of the quizzes.
-----------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top