RE: Generate document folders for Excel list.

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



oops
this line
forlderstr = Format(Trim(Str(cou)), "00#") + "_" + activesheet.cells(cou,1)
should read
folderstr = Format(Trim(Str(cou)), "00#") + "_" + activesheet.cells(cou,1)
my bad, typo....

--
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:

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?action=getinfo&userid=26300
View this thread: http://www.excelforum.com/showthread.php?threadid=511949


.



Relevant Pages

  • Re: Unlock Workstation without closing current session
    ... >> user edits something but changes their mind about wanting to save it, ... >under a different but similar name in the same folder when the machine ... intending to save it on their computer ...
    (microsoft.public.windowsxp.general)
  • Re: Problem using FSO with mapped drive...
    ... assuming IUSR is running your ASP pages, he doesn't know what x:\ is, ... need to either change the user ASP is running as, or use a UNC path (e.g. ... The folder contains user home directories. ... > Set FileSys = CreateObject ...
    (microsoft.public.inetserver.asp.general)
  • Re: Ask EU: Ubuntu
    ... /home folder is on the "other" drive. ... the /home/user_dir on the other disk by using the file browser. ... changed when looking with System Monitor. ... Never mind, let's press on. ...
    (uk.media.radio.archers)
  • Re: A postcard from the edge
    ... >> The internet is so massive it numbs the mind but I am constantly finding sites I ... If I join a site I will have a site specific folder where everything goes ... pictures from the monthly ...
    (uk.sport.football)
  • Re: Word "Save As" Lockup (Word XP, and Word 2003)
    ... Documents" or some other appropriate folder. ... This message is posted to a newsgroup. ... "Terry B. Connors" wrote in message ... > email attachments begin life and let XP recreate them - ...
    (microsoft.public.word.application.errors)