点击下载此附件
Dim strFile As String
Dim strFileLike As String
Dim strpath As String
Dim rst As Recordset
Dim i As Long
Set rst = Me.拷贝文件子窗体.Form.RecordsetClone
rst.MoveLast
rst.MoveFirst
For i = 0 To rst.RecordCount - 1
strFileLike = rst("将要复制的文件")
strpath = Left(strFileLike, InStrRev(strFileLike, "\"))
strFile = Dir(strpath, vbDirectory Or vbHidden Or vbNormal Or vbReadOnly)
'搜索当前目录
While strFile <> ""
If (GetAttr(strpath + strFile) And vbDirectory) <> vbDirectory Then
If strFile Like Mid(strFileLike, InStrRev(strFileLike, "\") + 1) Then
DoEvents
Me.Label1.Caption = "文件从: " & Chr(13) & Chr(10) & strpath & strFile & Chr(13) & Chr(10) & "拷贝到:" & Chr(13) & Chr(10) & txtBKPath & "\" & strFile
FileCopy strpath & strFile, txtBKPath & "\" & strFile
End If
End If
strFile = Dir '查找下一个目标
Wend
rst.MoveNext
Next
Me.Label1.Caption = Chr(13) & Chr(10) & Chr(13) & Chr(10) & "复制到这里"