Rename workbook that contains date

bmkelly

Board Regular
Joined
Mar 26, 2020
Messages
172
Office Version
  1. 365
Platform
  1. Windows
Hello,

I currently have 2 Google Analytic Reports that get emailed to me automatically and saved to my documents. These 2 Workbooks contain the previous date in the filename (I cant seem to change that in Google Analytics). Is there a way I can have VBA to rename the workbooks?

For Example:
These are the 2 names of the Workbooks that get saved to my documents:

Analytics All Web Site Data BLC Register 20200428-20200428
Analytics All Web Site Data WN Register 20200428-20200428

I would like to rename them to:

BLC Register
WN Register

Note- It works in a batch file I currently have but would like to have all of my code in VBA. I used this in the batch and it worked


Del "C:\Users\cnoet7\Documents\Volume Breakout\BLC Register.xlsx"
Del "C:\Users\cnoet7\Documents\Volume Breakout\WN Register.xlsx"

Ren "C:\Users\cnoet7\Documents\Volume Breakout\Analytics All Web Site Data BLC Register*.xlsx" "BLC Register.xlsx"
Ren "C:\Users\cnoet7\Documents\Volume Breakout\Analytics All Web Site Data WN Register*.xlsx" "WN Register.xlsx"

but it doesnt like the * at the end in VBA.
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Are you doing this in Excel or Google Sheets?
When you are running this, is the date in the file name always the current date?
 
Upvote 0

Forum statistics

Threads
1,214,970
Messages
6,122,514
Members
449,088
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top