-
Hi Graham,
Sorry for my stupidity but I'm still not following. I don't know what the report name is each day like I say. For example, today's report was called "Report_2017-09-06-05-53-04.xlsx", yesterday's was "Report_2017-09-05-05-46-13.xlsx" and the day before was called "Report_2017-09-04-05-39-22.xlsx", so a differ time each day. The only pattern is that it's run at 5am but the minutes and seconds differ every day. So I'm looking for the script to find this report and remove the timestamp (the last 9 characters).
So I could use your first script above and change the "- 2" to "- 9" but the strName = line needs alternating to pick up the ever changing report names. If it wasn't for the timestamp at the end I can do the following to find today's report but need an extra bit for the timestamp or the last 9 characters:
strName = "Report_" & Format(Date, "yyyymmdd") & [need-something-here-to-find-whatever-the-timestamp-will-be]".xlsx"
So I would be looking to automatically rename the following:
Report_2017-09-06-05-53-04.xlsx
Report_2017-09-05-05-46-13.xlsx
Report_2017-09-04-05-39-22.xlsx
to (respectively):
Report_2017-09-06.xlsx
Report_2017-09-05.xlsx
Report_2017-09-04.xlsx
Perhaps one solution could be to rename any report that beings with the filename "Report_" in strPath. In theory there will only ever be one "Report_yyyy-mm-dd-hh-mm-ss" report in that folder.
Ta.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules