|
http://support.microsoft.com/kb/207703/zh-cn
照上面的方法,我试了可以复制(已打开的文件)
Option Explicit
Declare Function apiCopyFile Lib "kernel32" Alias "CopyFileA" _
(ByVal lpExistingFileName As String, _
ByVal lpNewFileName As String, _
ByVal bFailIfExists As Long) As Long
Sub CopyFile(SourceFile As String, DestFile As String)
'---------------------------------------------------------------
' PURPOSE: Copy a file on disk from one location to another.
' ACCEPTS: The name of the source file and destination file.
' RETURNS: Nothing
'---------------------------------------------------------------
Dim Result As Long
If Dir(SourceFile) = "" Then
MsgBox Chr(34) & SourceFile & Chr(34) & _
" is not valid file name."
Else
Result = apiCopyFile(SourceFile, DestFile, False)
End If
End Sub
Sub 复制2()
CopyFile "C:\Documents and Settings\Administrator\Application Data\Microsoft\AddIns\宏病毒免疫工具v5.0.xla", "D:\宏病毒免疫工具v5.0.xla"
End Sub
|
评分
-
查看全部评分
|