DatePart question - add 1 day to final date on the filename

'Setup the Date parts so that we can incorporate into the file name

The script below when run, outputs the filename with today's date.   i.e., Merge10102013.txt.  I would like to be able to run it today and have tomorrow's date in the file name, i.e. Merge10112013.txt.

What changes can I make?  The DatePart script is listed below:

MM = DatePart("M", Date)

If Len(MM) = 1 Then
      MMM = "0" & MM
      MM = MMM
End If

DD = DatePart("D", Date)

If Len(DD) = 1 Then      
      DDD = "0" & DD
      DD = DDD
End If

YY = DatePart("YYYY", Date)

D = MM & DD & YY
Who is Participating?
lluddenConnect With a Mentor Commented:
d = Format(Date + 1, "MMDDYYYY")
Ken ButtersCommented:
try using just this in place of above code:

Dim D As String
D = Format(Format(Date + 1, "MM/dd/yyyy"), "MMddyy")

Open in new window

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.

All Courses

From novice to tech pro — start learning today.