|
想用代码复制A文件夹下所有文件到B文件夹下,文件名不变,自动覆盖。
我写的这样提示错误
SourceRoot = CurrentProject.Path & "\"
TargetRoot = CurrentProject.Path & "\"
PictureRoot = CurrentProject.Path & "\Picture\"
DestinationFile = CurrentProject.Path & "\Picture\*.*"
DoCmd.SetWarnings False
If DestinationFile = "" Or IsNull(DestinationFile) Then
MsgBox "您没有选择还原文件!", vbExclamation + vbOKOnly, "提示"
Else
FileCopy FileName, TargetRoot & "数据备份.RAR"
End If
'解压缩
Call Shell(SourceRoot & "RAR.EXE" & " E " & TargetRoot & "数据备份.RAR" & " " & SourceRoot, vbHide)
If MsgBox("您真的要还原成最后一次备份的数据吗?" & vbCr & vbCr & _
" 警告: 本操作将覆盖现有的数据 ! ", vbYesNo + vbQuestion, "数据维护") = vbYes Then
'导入EXCEL
DoCmd.TransferSpreadsheet acImport, 8, "数据库", TargetRoot & "数据库备份" & A, True, ""
MsgBox "数据库表已经成功从“:" & TargetRoot & "”目录中恢复!", vbInformation + vbOKOnly, "还原完成!"
Kill TargetRoot & "*.XLS"
FileCopy TargetRoot & "*.jpg", PictureRoot '在这一句时出错
另外如何将下面这一句中的通配符中的扩展名改成JPG和XLS
DestinationFile = CurrentProject.Path & "\Picture\*.*" |
|