Rename files in bulk using macro | Excel VBA
HTML-код
- Опубликовано: 5 сен 2024
- Telegram (for Live events, Quick Questions): t.me/letsautomate
Download File : github.com/kam...
Renaming files in bulk is easy using vba. In this tutorial, you'll learn how to rename thousands of files (may be of a specific extension) in one go.
There are two sub procedures explained in this example. One fetches names of all files in a folder and the other one helps in renaming them.
Watch this tutorial and do not forget to hit like and subscribe to our channel.
We are looking forward for your comments. :-)
I've been trying to figure out how to do exactly this literally all day! So many websites and videos made it seem so complicated and used so many more lines of code, and yet what you did is so simple and took hardly any time to do! Thank you so much!
P.S. I know absolutely nothing about VBA and was able to get this working in about 10 minutes or so. Don't know how this works, but it gets the job done so can't complain.
I can't believe someone would share such a valuable tool. I am super grateful for this. You are amazing. Thank you very much!
Glad it was helpful! Stay connected! :-)
This is unbelievable, man, you saved my life. it's so simple to use, download the .xlsm file, choose folder path. assign the names to be renamed, press button finish, The magic happens. :)
Thank you dear. Stay connected😃😃
First macro runs fine. The 2nd didn't work and kept generating a run-time error.
It's just amazing. I spent 3 hrs on some complicated codes. And finally this helped me quickly. Thank you so much.
Glad it helped!
I cant believe how come you can be so kind to save the world's time!! Thanks so much mate!!!
You are a saviour❤️ Thank you so muchhhhhhhh.. So easy to follow and completed task with out any error. 😍
This is literally game changing code for me... I had over 1,000 files I needed to convert to a different naming system and I thought I was going to die if I had to do it manually... now I just press 3 buttons... Christ this is a miracle!!!
Thanks mate !!!
This is absolutely amazing. I'm new to coding, but I am motivated to learn due to my new job. Thank you for the help!
Thank you for the feedback. Keep supporting.. :-)
Very much useful tutorial for novice users. It served my purpose easily. Thank you Kamal.
Thank you so very much! This is a task that I complete monthly. You have reduced the time in accomplishing this task substantially.
Great!
Did what exactly i was looking for... Thanks a lot... Earn a subscriber...
Thanks, this is very useful for my job. I always need to rename a lot files in a given order one by one, but now I will use a custom order list in excel and them run this code. It will save me a lot of time.
Everything runs very well. Thank you for share with us
So nice of you
Superb man.. you are too good. Thanks yaar brother..
Most welcome 😊
absolutely simple and clear piece of code..! great job.! kudos for this knowledge sharing..!
Thank you for the feedback.. Stay connected! :-)
Very clear video and explanation and code, I subscribed 👍
Welcome aboard!😀
Excellent ...thanks a lot for u ...from Indonesia
Welcome!
Thanksyou so much for help... Really appreciate ur support on call.
I sub'ed.
Great tool & very gracious of you to share the code!
Thanks Kamal!! This will save me a lot of time!!
This is life savior. Thanks a lot for this tool
dear Kamal, thank you very much, and much appreciated it.
all the best
Thank you very much. It saved my time for renaming a lot of files.
Glad it helped!
Many thanks, I have been looking for an easy solution. :)
Dear Kamal, thank you so much for your helpful video.
excellent solution. great coding.
Highly appreciated kamal
Many thanks for your kindness
Thank you for such a nice comment Tajammul! This really keeps me motivated to post such tutorials for community.
thank you for sharing!! truly amazing.. wish you success sir!
great videos , just a question if i want to rename the file and copy to another path ? the old file list in different sub folder
Thanks Kamal. Amazing and time efficient
Thank you Nimesh. Stay connected:-)
It's really useful bro thanks🌹🌹🌹.
This macro has a major flaw. If the file is not English characters then the macro will fails. I have to write one additional subroutine to get around that problem.
great. please post your updated code that others can also use.
Thanks lot sir it really very helpful for me thanks awsome 😊😃
Thank you Manoj.. Please subscribe and share with your friends and help my mission to teach a million students.. :-)
Great way of teaching
Thank you sir! You just made my night!
LOVE!!!!!! You made this sooooo simple! Thank you! Thank you!!!
Stay connected !!! :-)
Hey Thanks Boss, it help's me in my daily routine work. Thanks a a lot !
@Amol. that's awesome.. stay connected..
Hi Kamal, Thanks for sharing such valuable knowledge, i also updated the code as you taught, but unable to get the folder path in the bar, like as you have shared a template file , Please advise
Can you share your code/files with me so that I can debug?
it works! thank you.
How if in case there are xls files if we can change the sheet name as well at the same time
Thanks will be using your code, just need to modify it so that it can rename files in the subfolder also.
Did you come up with the fix so it could reach the subfolders also?
can you add some code to include all files in subfolders of the folder chosen to rename please
Sure.
Great video thank you. Can this also be used to change folder names too?
sure. .I'll post a tutorial on this subject soon.
I successfully did this before but now when I try to run the first part to fetch the names nothing happens. It just brings up a list of macros and ask me if I want ti run it and when I select run nothing happens. I’m not sure what I’m doing wrong, I did exactly what you did in the video.
Why is it showing an error - run time error '53': File not found?
Veer good video i leran new thing
So nice of you
Hi, we would follow up if the old file is Chinese font and show '?' & how can fix this?
Please can you try file names with space in your program in this video? does this work? example "C:\test\360_00 67.jpg" space included
Suberb man keep it up..Thank u so much
Welcome 👍 Stay connected
can u tell me pls which version is applicable of MS office? I use office 2007.here it is n't work.pls help & reply.
Awesome video. its a huge help
Thanks Manoj. Stay connected
Hi Kamal, is there a way to possibly modify the macro, so instead of showing only the files names inside the folder, it will show the name of files in the subfolders as well, so when we click on "Get Files Names' it displays all the files names? Thank you very much :)
Thank you very much. Worked like a charm!
Invaild Qualifier Error for IsEmpty is Coming. How can I Fix it ?
Hi sir, is that possible to sort it as date modified when you fetch the name? thanks
Hello. I hawe an issue. I receive an error when I try to renamd files that contain ș ț î ă â and. Di you hawe a solution for this?
Super one !! thank you loads
Glad you liked it! :-)
That’s a very useful and simple way of doing.
Can this done for the sheet of Excel files in a folder.
Say like there are 60 Excel Files with single sheet in each of them in same folder and I want to rename the sheet of every excel file.
Please make a video for above request
Thanks
Thank you Ifraz. I'll plan for a video on this soon. However if you need this urgently, feel free to write to me at excel.microk@gmail.com
Is there a VBA code that can search multiple folders and rename all of the files in the different folders? In column A I have the filepath down to the pdf that I want renamed and in Colum B I have what I want to change the name to.
Thanks for the video. The 2nd coding is not working. It’s shows Run-time error ‘5’; . Invalid procedure call or argument. Any thoughts why it’s not working?
macro may not be available on this workbook or all macros may be disabled
Right click on get file names. Select macros. Fetch files..edit. and change the location
Required macro to split the PDF file in to multiple files with different ranges of pages
Legend!
It helped me a lot! Thank you!
Brother tell us how did you create that 3 bottons please
Hi, it is very useful. But unfortunately, it copies file extension with it. Is there any way that the file extensions should not be copied.
Yes.. we can do it.. please attach your file (with code )to my email id and I'll send you the updated code..
Thank you for this, however I cannot get it to work. I edited the macro so it points to a folder path where my files are stored and thought that would be all I needed to do, however it isn't working.
Please share your file at excel.microk@gmail.com and I'll look into it..
First time I run it didn't work, then I realized that when I copied the folder path from the window and paste it in the VB, it didn't show the last back slash "\". It need to have that last back slash in order to work.
@@djmontoro Thank you this was my issue as well! Works great now
Thanks a lot.
Most welcome!
Thank you for sharing.
Stay connected😃
Sir , please share with some update in code., That is , no need extension name in file name, need only file name.
Hope you understand sir
Thanks,
Hi can you make another version so that it can get all filenames inside a a big foldet which include subfolder? Thanks a lot
I use this to rename mp3 files when I rip some of my audiobooks. Windows media player can't find the names so I have to rename them. I was able to reformat the names how I wanted but I couldn't get it to add the .mp3 at the end so I had to add it manually. Am I doing something wrong?
It is hard to understand what exactly you have done and what has happened. Can you record a small video of what steps you have performed so that I can see?
Hello, your Excel VBA renamed all my document name at once, but the document version is not a PDF file anymore, could you please help me further, many thanks.
Did you put extension in the output file names?
Can we create multiple folders with desired excel document inside all folder in bulk?
Hi Bro, you are fetching details into column A and B. Can we assign the same to some other column like D, E F ?
Moreover, to my previous comment and after using Name statement. I can say it is unstuck, failing or good-for-nothing. Unpredictable errors or fail to rename files (sure they are not opened, not readonly)
Relax Elias. I am sure you must be doing something wrong. Share your code with me.
@@xtremeExcel I am sure,
can you tell me why one of the following lines work where the other not ? I am programmer (~33 years) for many Languages. and mainly Mech Eng. so I can understand you fast. (.JPG & .jpg work both)
Name "D:\Test\660_000010.JPG" As "D:\Test\760_0009.JPG" work
Name "D:\Test\660_000010.JPG" As "D:\Test\660_0009.JPG" doesn't work
This is one of many
Name "D:\Test\660_0008.JPG" As "D:\Test\660_0001.JPG" work
Name "D:\Test\660_0000.JPG" As "D:\Test\660_0001.JPG" doesn't work
Hi
Could you do the video including buttons portion also and fetching names code is perfectly working but renaming code is not functioning and saying run time error.....
I don't know my code is not working. Please help me out
Hi I am trying to modify my file but unable to keep the format of the image.can you tell me how to keep the same format?
please send me your file. excel.microk@gmail.com
@Extreme Automation - Kamal Girdher Thanks A lot for such a great video, Its appreciable if u can share Codes for picking Folder path from a specific cell (In my Case "Sheet1"("O5")) in same workbook instead of pre-defined folder path, I tried to get a code for the same from internet, but i cound not make it. Thanks in advance for your support
Hi, it possible to have a word file that was just created take some data(names and values) from inside it and automatically introduce those values in the title of the file? When I close the new document at exit to have the file renamed in my folder automatically by taking the data of choice from inside it?
This is great. THX
Great, thanks. I'm getting debug on Name myPath & Cells(r, 1).Value As myPath & Cells(r, 2).Value
Thanks! Please share you file and screenshot of the error
@@xtremeExcel
This is the error: "Name myPath & Cells(r, 1).Value As myPath & Cells(r, 2).Value ". I don't know how to get the screenshot to send to you.
Hi, thank you for the video! I was wondering if it would be possible to use folder picker with this video rather than hard coding the file path. Would appreciate if you have such code.
Yes it is possible as well as recommended way.
@@xtremeExcel Thanks A lot for such a great video, Its appreciable if u can share Codes for picking Folder path from a specific cell in same workbook instead of pre-defined folder path, I tried to get a code for the same from internet, but i cound not make it. Thanks in advance for your support
Hi,
Using this simple code still useful in 2020. This works great, but now I'm trying for same name and I get this message:
"Run-time error '58':
File already exists"
Debugging highlights this line "Name myPath & Cells(r, 1).Value As myPath & Cells(r, 2).Value"
Any tips? if file name already exists then replace without asking or any msgbox
.
You help much more appreciate.
You are not defining the variable r here, i think it would be a good practice to define all ur variables. Or do you think it is really not necessary to define variable r??
tq Sir.
Welcome
Thank you so much for this!! This is a wonderful tool. I tried and it worked, however it is converting my PDF to file. How do I keep the .pdf? Thank you!
Can you share some more details of your input and outout. :-)
@@xtremeExcel I am trying to change names of multiple PDF files. When I use the template and change the name, it converts it from .pdf to type: file. When I try to open the file it makes me select the output. I am able to then open it in PDF if I select "Open with Adobe". Is there a way to keep it in .pdf type after changing the name? I hope this makes sense.
@@MegaRockstar90210 It worked for me by just adding .pdf to the end of the file name.
Hi dood, my files corrupting once macro done it's work... Gimme solution plz...
Does this work for Mac I can't get the file names thing to open...
Hello to all, I have 4000 files in .doc to convert into .docm. I thaught that the macro as shown in the video would have helped. Unfortunately this message is poping up "cannot run the macro. The macro may not be available in this workbook or all macros may be disabled"
I have enabled all macros, still the same issue. Does anyone have a solution? Thank in advance
Thank you very much....
stay connected..
thanks
This isn't working for me
I get an error
Can you add a video or include code for extraction of files from zipped folder? Thank you
Thanks Man!
appricate your grat knowladge
Thanks my boro
Thanks bro it worked
man your code rulz. thank you very much sir :)