Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15042

FileCopy Doesnt Copy

$
0
0
Hello All,

Ran into an interesting occurrence today. FileCopy does not seem to work, but the CopyFile using fso does. What gives? What are the circumstances when FileCopy does not copy. There is no error thrown, it just does not copy the file. When I go to the target folder, it is blank.

Thanks

Code:

Function CopyFile(str_Source, str_Target)


Dim str_Source As String
Dim str_Target As String

    str_Source = App.Path & "\My Data Files\My Projects\specialFiles\" & strFile & ".txt"
    str_Target = strTargetFolderPath & "\" & strFile & ".txt"

Dim fso As Object
   
    Set fso = CreateObject("Scripting.FileSystemObject")
        fso.CopyFile str_Source, str_Target
    Set fso = Nothing
 
'Why doesn't "this", down below in red, work? Doing a copy via fso as above works but not this.
    'FileCopy str_Source, str_Target


End Function


Viewing all articles
Browse latest Browse all 15042

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>