ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   Copy a folder and objects (https://www.excelbanter.com/new-users-excel/97136-copy-folder-objects.html)

John

Copy a folder and objects
 
From a workbook I wanted a button that would copy a folder to another
drive. After dinging around I came up with this:

Set CpyFolder = CreateObject("Scripting.FileSystemObject")
CpyFolder.CopyFolder "c:\TestIt", "d:\TestIt", overwrite
End Sub

This works but I have no idea why. The CopyFolder only works if you use
a Set = something then use the Something.copyfolder. This seems just
idiotic and useless.

Why not just "Copy c:\folder, d:\folder" and make it easy? What is the
purpose of adding the complication of objects?

Also... the copy process was 10 times slower than dragging it in xp.

Is there a faster way of doing it?

Thanks

John


Ron de Bruin

Copy a folder and objects
 
hi John

Why not just "Copy c:\folder, d:\folder" and make it easy?

You can do that with files

Or use Name to move a folder

It is not fast if you copy, maybe windows shell is faster ? but with the FileSystemObject
you can test easily if a folder exist.

I have some info here
http://www.rondebruin.nl/folder.htm

I update it this weekend with specialfolder info


--
Regards Ron de Bruin
http://www.rondebruin.nl



"John" wrote in message ...
From a workbook I wanted a button that would copy a folder to another drive. After dinging around I came up with this:

Set CpyFolder = CreateObject("Scripting.FileSystemObject")
CpyFolder.CopyFolder "c:\TestIt", "d:\TestIt", overwrite
End Sub

This works but I have no idea why. The CopyFolder only works if you use a Set = something then use the Something.copyfolder. This
seems just idiotic and useless.

Why not just "Copy c:\folder, d:\folder" and make it easy? What is the purpose of adding the complication of objects?

Also... the copy process was 10 times slower than dragging it in xp.

Is there a faster way of doing it?

Thanks

John





All times are GMT +1. The time now is 04:06 AM.

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