Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Jim,
'------------------- Sub createfolders() Dim cou As Long Dim FolderStr As String Dim FileSys As Object For cou = 1 To ActiveSheet.UsedRange.Rows.Count FolderStr = Format$(Trim$(cou), "00#") & "_" & ActiveSheet.Cells(cou, 1).Value Set FileSys = CreateObject("Scripting.FileSystemObject") FileSys.createfolder "C:\RESERVES\" & FolderStr Next Set FileSys = Nothing End Sub '---------- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware "Jim15"wrote in message... I have the letters A - O in rows 1 - 15 of column A on my Excel spreadsheet. However, instead of the following routine making subfolders under C:\RESERVES I get the error "file already exists". Can someone help? Thanks, Jim 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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to move files gets an error if it already exists... | Excel Worksheet Functions | |||
Excel PageSetup Error even when a printer Exists | Excel Programming | |||
Error if 'name' already exists | Excel Programming | |||
File Name Exists Error Trap | Excel Programming | |||
the file already exists - do you want to replace the existing file? | Excel Programming |