Change the workbook name from a path without opening it(Dynamic)

Manoj Gaidhankar

New Member
Joined
May 27, 2022
Messages
20
Office Version
  1. 2021
Platform
  1. Windows
Hi there,

If the workbook name is dynamic, I have trouble renaming it from a given path. Please find the below code if the workbook name is fixed(SampleFile) and not dynamic

VBA Code:
Name "C:\Users\Dell\Desktop\myFolder\SampleFile.xlsx" As _
"C:\Users\Dell\Desktop\myFolder\myNewFile.xlsx"

If you could please help me with the above code while the workbook name is dynamic.

Thank you.
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Maybe if you provided examples of the new file path and where that value is kept...
 
Upvote 0
Thank you for your reply. Lets assume both the paths are the same as mentioned above. Here I just need to change the workbook name.

Example : If the file name is File1, File2, FileABC or FileXYZ.

How do I change the file name to "myNewFile" if the file name is any of the xyz names.

I hope this information helps orelse please let me know if you need anything else.
 
Upvote 0
Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Change the workbook name without opening it (Dynamic)
If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0
I have posted later about this query but will try not to provide the link in the future


Thank you
 
Upvote 0

Forum statistics

Threads
1,214,976
Messages
6,122,539
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