Poundland
06-26-2008, 04:22 AM
Dear all,
I have this problem.
I am trying to code a date variable that can be used in a file extension and can be calculated to cahnge the date.
I have tried this code;
Dim strDate As String
Dim strNewDate As String
strDate = Format(Now, "dd mmm yyyy")
This give me the date and the date format that I require for my file extension. But when I try to perform the following calculation is does not work.
strDate = Format((strNewDate - 1), "dd mmm yyyy")
It will work when I assign the variables as this;
Dim strDate As Date
Dim strNewDate As Date
But this then does not allow me to use the date in a file extension as I cannot change the format of this date from __/___/____ and / cannot be used in a file extension.
Have you got any ideas.
Basically I am using the two date variables as I want to create the file extension with a Monday date regardless of which day you run the code on, and then want to open another file which is 7 days prior to the Monday date.
I have this problem.
I am trying to code a date variable that can be used in a file extension and can be calculated to cahnge the date.
I have tried this code;
Dim strDate As String
Dim strNewDate As String
strDate = Format(Now, "dd mmm yyyy")
This give me the date and the date format that I require for my file extension. But when I try to perform the following calculation is does not work.
strDate = Format((strNewDate - 1), "dd mmm yyyy")
It will work when I assign the variables as this;
Dim strDate As Date
Dim strNewDate As Date
But this then does not allow me to use the date in a file extension as I cannot change the format of this date from __/___/____ and / cannot be used in a file extension.
Have you got any ideas.
Basically I am using the two date variables as I want to create the file extension with a Monday date regardless of which day you run the code on, and then want to open another file which is 7 days prior to the Monday date.