Copying a file to another location within seconds:
Items Needed:
Button
Names of controls needed:
<Any name you like>
Code:
'Declare the Variables
Dim FiletoCopy As String
Dim NewFileCopy As String
'Set the variables
FiletoCopy = "C:\text.txt"
NewFileCopy = "C:\NewText.txt"
'If the file exists contine
If System.IO.File.Exists(FiletoCopy) = True Then
'copy the file to the new location
'bear in mind that the destination must exist!
System.IO.File.Copy(FiletoCopy, NewFileCopy)
MsgBox("File Copied")
'display error if it couldnt be copied
else
msgbox ("Could not copy file!")
'end the IF statement
End If