Monday, May 24, 2010

[VB6] fso.copyfolder doesnt work for me?

this is my code:





Form1.FSO.CopyFolder Replace(Form1.Folder, "\", "/"), "c:/backup/" %26amp; Date %26amp; " " %26amp; Time





when i try to do this i get the error message like: 'Runtime error 5 invalid procedure call or argument'





what im doing wrong? thanks.

[VB6] fso.copyfolder doesnt work for me?
As previous colons arent supported as folder names nor are the slashes that may occur within the DATE that you specify, which will cause the runtime error, I would suggest either removing the colons, or adopting a new method for example:





Form1.FSO.CopyFolder Replace(Form1.Folder, "\", "/"), "c:/backup/" %26amp; Format(Date,"ddmmyyyy") %26amp; " " %26amp; Format(Time,"hhmmss")





or if that doesnt work





Form1.FSO.CopyFolder Replace(Form1.Folder, "\", "/"), "c:/backup/" %26amp; Day(Now) %26amp; Month(Now) %26amp; Year(Now) %26amp; " " %26amp; Hour(Now) %26amp; Minute(Now) %26amp; Second(Now)





This will create a folder as such for example "C:\backup\31052007 94352" (as in 31/05/2007, 9:43:52AM)
Reply:Time function will return hh:mm:ss. Windows does not support ':' in folders names.





Nelson Bittencourt


See my web site:


http://www1.webng.com/nbittencourt/index...


No comments:

Post a Comment