Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Generate document folders for Excel list.
I have a need to generate separate folders in a directory using a colum list in Excel. I want the program to take an Excel file wit descriptions in each row (column A only) and generate separate folder with the descriptions being the folder name. Would generate anywher from 50 - 100 (or more) directory folders. Thanks, Ji -- Jim1 ----------------------------------------------------------------------- Jim15's Profile: http://www.excelforum.com/member.php...fo&userid=2630 View this thread: http://www.excelforum.com/showthread.php?threadid=51194 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Generate document folders for Excel list.
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Generate document folders for Excel list.
In addition, I would like the program to label the folders starting from row 1 and label them like 1_foldername, 2_foldername, 3_foldername, 4_foldername, etc. The row names are in importance of information and I do not want them arranged alphabetically. 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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Generate document folders for Excel list.
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...o&userid=26300 View this thread: http://www.excelforum.com/showthread...hreadid=511949 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Generate document folders for Excel list.
I am getting a syntax and compile error on the dim cou .... line. An suggestions? Thanks, Jim Sub createfolders() ' ' dim cou as integer,Dim FolderStr as string, FileSys For cou = 1 To ActiveSheet.UsedRange.Rows.Count FolderStr = Format(Trim(Str(cou)), "00#") + "_" ActiveSheet.Cells(cou, 1) Set FileSys = CreateObject("Scripting.FileSystemObject") FileSys.createfolder C:\ + RESERVES Next End Su -- Jim1 ----------------------------------------------------------------------- Jim15's Profile: http://www.excelforum.com/member.php...fo&userid=2630 View this thread: http://www.excelforum.com/showthread.php?threadid=51194 |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Generate document folders for Excel list.
Thanks for the assistance. I am know getting an error on the line right before the "Next" line. I am trying to create a folder called C:\RESERVES on the hard drive with subfolders as listed in column A. Sub createfolders() ' ' CreateFolders Macro ' Macro recorded 3/22/2006 by JBW ' Dim cou As Integer, FolderStr As String, FileSys For cou = 1 To ActiveSheet.UsedRange.Rows.Count FolderStr = Format(Trim(Str(cou)), "00#") + "_" + ActiveSheet.Cells(cou, 1) Set FileSys = CreateObject("Scripting.FileSystemObject") FileSys.createfolder C:\ + RESERVES Next End Sub -- Jim15 ------------------------------------------------------------------------ Jim15's Profile: http://www.excelforum.com/member.php...o&userid=26300 View this thread: http://www.excelforum.com/showthread...hreadid=511949 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can I create folders in explorer from an excel list | Excel Discussion (Misc queries) | |||
Please help to list folders and subfolders tree in Excel or Word | Excel Discussion (Misc queries) | |||
List Folders using Excel | Excel Programming | |||
Can anyone help me Create Excel list of files in windows folders | Excel Worksheet Functions | |||
Creating folders and subfolders from excel file list | Excel Discussion (Misc queries) |