Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default please help me with folder and subfolders

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.

  #2   Report Post  
Posted to microsoft.public.excel.programming
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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default please help me with folder and subfolders

Bob thank you very much!! With some modifications it works very well!!
Thank's again.

Greetings,
Pieros.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to decide folder-depth or How to select more folders/subfolders (folder-tree) ? Subteam Excel Discussion (Misc queries) 2 May 7th 06 08:14 PM
copy subfolders, replace text in files and save files in copied subfolders pieros Excel Programming 0 November 1st 05 12:08 PM
Delete all files within a folder (incl subfolders) Steph[_3_] Excel Programming 1 September 30th 04 09:59 PM
Create subfolders in a folder Myrna Rodriguez Excel Programming 2 July 15th 04 04:10 PM
Trouble making a report of all Files within a Folder and all Subfolders? SuperJas Excel Programming 2 April 2nd 04 02:41 AM


All times are GMT +1. The time now is 07:55 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"