ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy folder and paste to another folder (https://www.excelbanter.com/excel-programming/334751-copy-folder-paste-another-folder.html)

ddiicc

Copy folder and paste to another folder
 
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

Bob Phillips[_7_]

Copy folder and paste to another folder
 
Dim oFSO As Object
Set oFSO = CreateObject("Scripting.FileSystemObject")
oFSO.CopyFolder "c:\mydocuments\*\*", "c:\tempfolder\", True


--
HTH

Bob Phillips

"ddiicc" wrote in message
...
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




ddiicc

Copy folder and paste to another folder
 
Thanks alot Bob..

"Bob Phillips" wrote:

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


--
HTH

Bob Phillips

"ddiicc" wrote in message
...
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





karrde97

Copy folder and paste to another folder
 

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

--
karrde9
-----------------------------------------------------------------------
karrde97's Profile: http://www.excelforum.com/member.php...fo&userid=2546
View this thread: http://www.excelforum.com/showthread.php?threadid=38782


karrde97[_2_]

Copy folder and paste to another folder
 

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!


--
karrde97
------------------------------------------------------------------------
karrde97's Profile: http://www.excelforum.com/member.php...o&userid=25461
View this thread: http://www.excelforum.com/showthread...hreadid=387823



All times are GMT +1. The time now is 10:38 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com