• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

EXCEL VBA - Auto create folder based on filename and move the file into it's folder

Monty

Well-Known Member
Hello Experts.

I am working on automation requirment using VBA to Auto create folder based on filenames and move the file into it's folder by creating folders as per the files.

Step 1
Unzip the folder which consists of text files.

Step 2

Creat a folder on todays date example : 12 Oct 22.
Step 3
From unziped folder move same file names to resp2ctve folders by creating folder.

Example:

Basically, I want to run a VBA for all .txt from unzipped folder and copy to current day folder.

So, all .txt below will go to AA folder:
AA-1500.txt
AA-1000-41.txt
AA-1005.txt
AA-1000.txt
AA-1000-S2.txt
AA-1045.txt

These text files will go to AB folder:
AB-10452.txt
AB-10800.txt
AB-10700.txt
AB-10080.txt

Requesting your quick help
 
Last edited:
For this I would use the FileSystemObject, which gives to VBA (and VBScript and other languages) the ability to manipulate files and folders. You'll find documentation on the FileSystemObject at https://learn.microsoft.com/en-us/p...developer/windows-scripting/hww8txat(v=vs.84).

That might be enough to get you started, if you know how to write a VBA program at all. If you don't know anything about programming, and you want someone to write the whole program for you, I'm not your guy. (I'm more the teach-a-man-to-fish type.) But let me know if you have more questions.
 
Back
Top