Copy folder and paste to another folder

G

Guest

Hi there,
Can anyone kindly tell me what is the script for the macro,
for copying a folder, then pasting and overwrite to another folder.

Pls help
 
B

Bob Phillips

Dim oFSO As Object
Set oFSO = CreateObject("Scripting.FileSystemObject")
oFSO.CopyFolder "c:\mydocuments\*\*", "c:\tempfolder\", True
 
G

Guest

Thanks alot Bob..

Bob Phillips said:
Dim oFSO As Object
Set oFSO = CreateObject("Scripting.FileSystemObject")
oFSO.CopyFolder "c:\mydocuments\*\*", "c:\tempfolder\", True
 
K

karrde97

I am trying to do the same thing except my source directory changes wit
each operation.

my_path2 = (source directory)
my_save2 = (target directory)

Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Set a = fso.copyfolder(my_path2, my_save2, True)

The directory gets copied except I get a Type mismatch error and m
macro stops. I've tried all kinds of stuff and I can't get around th
error
 
K

karrde97

Nevermind. Looks like I had some issues with my string not being
formatted correctly. Works perfect now. Bob, your code help get me back
on track. Thanks!
 

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