View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default please help me with folder and subfolders

Here is some code

'-----------------------------------------------------------------------
Sub NewFolders()
'-----------------------------------------------------------------------
Dim FSO As Object
Dim oSubFolder As Object
Dim oFolder As Object

Set FSO = CreateObject("Scripting.FileSystemObject")

Set oFolder = FSO.GetFolder("C:\MyTest")
MkDir "C:\Backups"
MkDir "C:\Backups\" & oFolder.shortname
For Each oSubFolder In oFolder.Subfolders
MkDir "C:\Backups\" & oFolder.shortname & "\" & oSubFolder.Name
Next

End Sub



--

HTH

RP
(remove nothere from the email address if mailing direct)


"pieros" wrote in message
oups.com...
Can anyone help me with the following;
I've got an original folder with several original subfolders. With VBA
I want to create a testfolder with the same name as the original folder
but in another location. Then I want to create testsubfolders in the
new testfolder with the same names as the original subfolders.
Greetings.