I am having problems with filesystemobject. I have one that checks to see if a folder exists and works, but another won't copy a file. I get a syntax error. Here is my code:
Anyone have any ideas? Thanks!
Code:
Dim fso, fs As Scripting.FileSystemObject
Set fso = New FileSystemObject
Set fs = New FileSystemObject
If Not fso.FolderExists(filepath) Then 'this works
fso.CreateFolder (filepath)
End If
'these lines cause the syntax error
'fs.CopyFile (tempname, filepath)
fs.CopyFile ("c:\autoexec.bat", "c:\temp")
Anyone have any ideas? Thanks!