ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   FileCopy (https://www.excelbanter.com/excel-programming/329626-filecopy.html)

Andibevan[_2_]

FileCopy
 
Hi All,

Why does the following code not work it gets an error Run-Time error '450'
"Wrong number of arguments or invalid property assignemnt".?

Sub copy_copy
Set FS = CreateObject("Scripting.filesystemobject")

FS.copyfolder.copyfolder "S:\temp_Start\*", "E:\Test\"

End Sub

Thanks

Andi



Alok

FileCopy
 
I tried the following code and it worked

Sub Test()
Dim fs As New FileSystemObject
fs.CopyFolder "C:\Temp1", "c:\Temp2"
End Sub

Please note that C:\Temp1 should already be there. C:\Temp2 will be created.
Also when looking at the FileExplorer to check if the folder has been
created, press the F5 key to refresh the list of folders/files.

Alok Joshi

"Andibevan" wrote:

Hi All,

Why does the following code not work it gets an error Run-Time error '450'
"Wrong number of arguments or invalid property assignemnt".?

Sub copy_copy
Set FS = CreateObject("Scripting.filesystemobject")

FS.copyfolder.copyfolder "S:\temp_Start\*", "E:\Test\"

End Sub

Thanks

Andi




Chip Pearson

FileCopy
 
Try something like

Dim FSO As Object
Set FSO = CreateObject("Scripting.FileSystemObject","")
FSO.CopyFolder "H:\Temp\*.*", "H:\Temp2"
FSO.CopyFile "H:\Temp\*.*", "H:\Temp2"



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Andibevan" wrote
in message ...
Hi All,

Why does the following code not work it gets an error Run-Time
error '450'
"Wrong number of arguments or invalid property assignemnt".?

Sub copy_copy
Set FS = CreateObject("Scripting.filesystemobject")

FS.copyfolder.copyfolder "S:\temp_Start\*", "E:\Test\"

End Sub

Thanks

Andi






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

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