How to create multiple subfolders using VBA
You could set up a loop, but you didn't share enough info to do that.
You could put the folder names in a worksheet (A1:A1000) and loop through that.
Brad wrote:
I have not tried this with VBA, but I have done it with AutoCAD. You could
use Excel to write the code. The main trick is to use concatenation to
build up the single lines of code, and then copy the column with the
concatenated cells to your macro.
Brad
Excel 2002 on XP Pro SP 3
Excel 2007 on Vista 64
"ScottMsp" wrote in message
...
Dave,
My problem is that I have over 1,000 folders that I need to make. I
presume
there is a more effecient way than creating over 1,000 lines of code?
Thanks in advance.
"Dave Peterson" wrote:
Just make the subfolders in order:
on error resume next 'in case the folder already exists
mkdir "C:\mainfolder"
mkdir "C:\mainfolder\subfolder1"
mkdir "C:\mainfolder\subfolder1\newsubfolder1"
mkdir "C:\mainfolder\subfolder1\newsubfolder2"
mkdir "C:\mainfolder\subfolder2"
mkdir "C:\mainfolder\subfolder2\newsubfolder1"
mkdir "C:\mainfolder\subfolder2\newsubfolder2"
....
on error goto 0
ScottMsp wrote:
Hello and thanks for reading my question.
I need some VBA programming help.
I have a main folder with subfolders in it. I want to add a new
subfolder
to each subfolder in the directory.
It would look something like this
Main Folder
Subfolder1
NewSubfolder
Subfolder2
NewSubfolder
Subfolder3
NewSubfolder
Subfolder4
NewSubfolder
I was able to use this VBA to do it for one folder, but I need it to
look
through all Subfolders
MkDir ("C:\MainFolder\Subfolder1\Subfolder1.1")
How do I look through each subfolder and add a new subfolder under each
subfolder?
Thanks in advance.
--
Dave Peterson
.
--
Dave Peterson
|