Option Explicit
Private Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal bFailIfExists As Long) As Long
Private Sub Form_Load()
Dim strSourceFile As String
Dim strTargetFile As String
strSourceFile = "D:\MSDN_forVB.rar" '//源文件
strTargetFile = "D:\vb\MSDN_forVB.rar" '//目标文件
'win32api的参数一,表示源文件,二表示目标文件,三表示.如果文件存在,为true则复制失败,为false则覆盖,
CopyFile strSourceFile, strTargetFile, True
MsgBox "复制完毕"
End Sub