tabletopjoe
New Member
- Joined
- Jan 10, 2018
- Messages
- 6
Hello, I am creating a macro that regularizes file names and I'm having difficulty assigning the dates within filenames to a variable. The file names look something like this:
"Grants Report S-17, First Response, dated 3-14-2015"
Alternatively they might look like this:
"3-14-2015 1st Response from Mike to Grants Report S-17"
And so forth. The only piece I'm missing is how to dynamically extract dates from the filenames. Their format varies a bit, but I can work around those variations and I am just looking for ways to identify MMDDYYYY out of any particular string and assign that date to a variable. The resulting DateVariable is concatenated along with the rest of the filename's pieces like this:
Any tips & tricks are most appreciated!
"Grants Report S-17, First Response, dated 3-14-2015"
Alternatively they might look like this:
"3-14-2015 1st Response from Mike to Grants Report S-17"
And so forth. The only piece I'm missing is how to dynamically extract dates from the filenames. Their format varies a bit, but I can work around those variations and I am just looking for ways to identify MMDDYYYY out of any particular string and assign that date to a variable. The resulting DateVariable is concatenated along with the rest of the filename's pieces like this:
Code:
ResultName = ReportNum & ResponseNum & " " & ResponseSource & " " & DateVariable
Any tips & tricks are most appreciated!