#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 318
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
FileCopy Andibevan[_2_] Excel Programming 6 May 12th 05 10:13 AM
FileCopy problem rju[_6_] Excel Programming 0 August 9th 04 05:05 PM
FileCopy and read-only Dkline[_2_] Excel Programming 2 April 14th 04 05:50 AM
FileCopy Dana DeLouis[_5_] Excel Programming 0 August 11th 03 12:57 PM
FileCopy John Green[_2_] Excel Programming 1 August 5th 03 08:55 AM


All times are GMT +1. The time now is 02:31 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"