Copy a folder in VB

G

Guest

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
 
G

Guest

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
 
D

Dave Peterson

Check your other thread for more responses.
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top