Highlight all by clicking in box
' Copy the file C:MyStufftemp.txt to C:Junkbuffer.txt.
' Do not overwrite C:Junkbuffer.txt if it already exists.
Dim retval As Long ' return value
' copy the file
retval = CopyFile("C:MyStufftemp.txt", "C:Junkbuffer.txt", 1)
If retval = 0 Then ' failure
Debug.Print "Copy failed -- C:Junkbuffer.txt already exists.
Else ' success
Debug.Print "Copy succeeded."
Private Declare Function CopyFile Lib "kernel32" _
Alias "CopyFileA" (ByVal lpExistingFileName As String, _
ByVal lpNewFileName As String, ByVal bFailIfExists As Boolean) As Long
Adding your comment. Please wait...
Thanks for adding your comment!. After further review it will be added.
There was a problem adding your comment. Please try again.
Please complete all the fields in the form before sending.