View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
ben ben is offline
external usenet poster
 
Posts: 67
Default Generate document folders for Excel list.

use this instead then




sub createfolders()
dim cou as integer,Dim FolderStr as string, FileSys
for cou = 1 to activesheet.usedrange.rows.count
forlderstr = Format(Trim(Str(cou)), "00#") + "_" + activesheet.cells(cou,1)
Set FileSys = CreateObject("Scripting.FileSystemObject")
FileSys.createfolder "C:\"+folderstr
next
end sub


this will organize numerically and not by text

--
When you lose your mind, you free your life.
Ever Notice how we use '' for comments in our posts even if they aren''t
expected to go into the code?


"ben" wrote:

sub createfolders()
dim cou as integer,Dim FolderStr as string, FileSys
for cou = 1 to activesheet.usedrange.rows.count
forlderstr = activesheet.cells(cou,1)
Set FileSys = CreateObject("Scripting.FileSystemObject")
FileSys.createfolder "C:\"+folderstr
next
end sub

replace "C:\" with appropriate drive and subfolder where they will be placed
also, certain characters are illegal in folder names, and if the folder
already exists the createfolder method will fail.
Xl2003



--
When you lose your mind, you free your life.
Ever Notice how we use '' for comments in our posts even if they aren''t
expected to go into the code?


"Jim15" wrote:


I have a need to generate separate folders in a directory using a column
list in Excel. I want the program to take an Excel file with
descriptions in each row (column A only) and generate separate folders
with the descriptions being the folder name. Would generate anywhere
from 50 - 100 (or more) directory folders.

Thanks,

Jim


--
Jim15
------------------------------------------------------------------------
Jim15's Profile: http://www.excelforum.com/member.php...o&userid=26300
View this thread: http://www.excelforum.com/showthread...hreadid=511949