'先声明复制函数 2Private Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal bFailIfExists As Long) As Long
方法一:带属性
1s = App.Path '当前目录 2 rst = CopyFile(s & "\1.txt", "D:\1.txt", 0) 3If rst = 0 Then 4 MsgBox "替换不成功!" 5Else 6 MsgBox "替换成功!" 7End If
方法二:不带属性
1s = App.Path '当前目录 2FileCopy s & "\1.txt", "D:\1.txt"
本文链接:https://www.kinber.cn/post/4930.html 转载需授权!
推荐本站淘宝优惠价购买喜欢的宝贝: