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

shenryrgj
shenryrgj used Ask the Experts™
on
'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
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
d = Format(Date + 1, "MMDDYYYY")
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

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial