Naresh Patel
asked on
Creting Folder Via Excel VBA
Hi Experts,
Is there is way to create folder via excel VBA.
I have two list of data - column 1 all Sector names, column 2 list of the company's . Want to create all sector folder & in that folders want to create Sub Folders of companies name as per in which its sector.
See attached.
Is there is way to create folder via excel VBA.
I have two list of data - column 1 all Sector names, column 2 list of the company's . Want to create all sector folder & in that folders want to create Sub Folders of companies name as per in which its sector.
See attached.
No attachment.
ASKER
ASKER
Are you with me?
itjockey,
I have used the code from Chip Pearson's MakeMultiStepDirectory for several projects and it has worked well for me. The full code and explanation of the steps is located at:
http://www.cpearson.com/ex cel/MakeDi rMulti.asp x
HTH,
Jerry
I have used the code from Chip Pearson's MakeMultiStepDirectory for several projects and it has worked well for me. The full code and explanation of the steps is located at:
http://www.cpearson.com/ex
HTH,
Jerry
ASKER
0% knowledge of VBA Coding...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Mr.ProdOps,
I thought it will take at least 30 Second to create all folders. But what happened - one click and done.....surprised ... :)
As my question is solved ...just for understanding ...what do I mean y this?
Thank you very Much
I thought it will take at least 30 Second to create all folders. But what happened - one click and done.....surprised ... :)
If you want to include periods in the subdirectory names, you must check the checkbox as shown below. The fully qualified subdirectory name that will be created is in the column "SubDirName".
As my question is solved ...just for understanding ...what do I mean y this?
Thank you very Much
ASKER
Perfect & Awesome.
If you want to include periods in the subdirectory names, you must check the checkbox as shown below.The code originally written by Chip Pearson checks for a period after the last slash (\) in the subdirectory name. If it finds a period after the last slash, it assumes the name is a file name and skips that record, not creating the subdirectory name. As an Example, if it found the record - "C:\User\ITJockey\Medical\
There were four records in the data you provided that had periods as part of the Company name. In order to create those four, I added an IF statement in the VBA code to see if the Checkbox was checked and bypass the check for a period after the last slash if it was.
HTH,
Jerry
ASKER