Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Creting Folder Via Excel VBA

Posted on 2014-09-23
10
Medium Priority
?
237 Views
Last Modified: 2014-09-26
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.
0
Comment
Question by:Naresh Patel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
10 Comments
 
LVL 27

Expert Comment

by:MacroShadow
ID: 40340905
No attachment.
0
 
LVL 8

Author Comment

by:Naresh Patel
ID: 40340966
0
 
LVL 8

Author Comment

by:Naresh Patel
ID: 40341094
Are you with me?
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
LVL 16

Expert Comment

by:Jerry Paladino
ID: 40341166
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/excel/MakeDirMulti.aspx

HTH,
Jerry
0
 
LVL 8

Author Comment

by:Naresh Patel
ID: 40341185
0% knowledge of VBA Coding...
0
 
LVL 16

Accepted Solution

by:
Jerry Paladino earned 2000 total points
ID: 40345316
The attached file should create your subdirectories of Sector and Company names.   The program requires that you provide a Base subdirectory that already exists and your subdirectory names will be created below that base directory.   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".Q_28524413 worksheet pageQ-28524413-Create-Multiple-Subdirectorie
0
 
LVL 8

Author Comment

by:Naresh Patel
ID: 40345371
Mr.ProdOps,

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
0
 
LVL 8

Author Closing Comment

by:Naresh Patel
ID: 40345373
Perfect & Awesome.
0
 
LVL 16

Expert Comment

by:Jerry Paladino
ID: 40345710
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\Vitacorp\ExpenseReports.xlsm" within the list, it would skip that record and move to the next one.

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
0
 
LVL 8

Author Comment

by:Naresh Patel
ID: 40345734
OK Thanks......


if you have time pls look in to this .csv To .txt


Thanks
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question