#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 295
Default Copy a folder in VB

Can someone help me on this one please. I want to use a macro to do backups,
but the following code work. My sub does have a different name, but surely
that doesn't matter.

Sub CopyFolder()
Dim fso As Scripting.FileSystemObject
Set fso = New Scripting.FileSystemObject
fso.CopyFolder "c:\old", "c:\new"
End Sub

Thanks, Brett
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default Copy a folder in VB

This works. I changed the directory. You had "new" in the file. I think
the code you used was from a C#, or C++ compiler.

Sub CopyFolder()
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
fso.CopyFolder "c:\temp\old", "c:\temp\new"
End Sub


"Brettjg" wrote:

Can someone help me on this one please. I want to use a macro to do backups,
but the following code work. My sub does have a different name, but surely
that doesn't matter.

Sub CopyFolder()
Dim fso As Scripting.FileSystemObject
Set fso = New Scripting.FileSystemObject
fso.CopyFolder "c:\old", "c:\new"
End Sub

Thanks, Brett

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Copy a folder in VB

Check your other thread for more responses.

Brettjg wrote:

Can someone help me on this one please. I want to use a macro to do backups,
but the following code work. My sub does have a different name, but surely
that doesn't matter.

Sub CopyFolder()
Dim fso As Scripting.FileSystemObject
Set fso = New Scripting.FileSystemObject
fso.CopyFolder "c:\old", "c:\new"
End Sub

Thanks, Brett


--

Dave Peterson
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
Copy a folder by macro Brettjg Excel Discussion (Misc queries) 6 March 19th 07 11:51 PM
Copy a folder and objects John New Users to Excel 1 July 1st 06 11:00 AM
save a backup copy in different folder GT Excel Discussion (Misc queries) 3 May 11th 06 08:36 PM
Copy a cell to all workbooks within a folder. Andy T Excel Discussion (Misc queries) 16 February 3rd 05 12:14 AM
Copy files from spreadsheet into folder Intotao Excel Discussion (Misc queries) 3 January 28th 05 12:38 AM


All times are GMT +1. The time now is 09:22 PM.

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"