用WINRAR作ACCESS备份
时间:2006-11-22 22:42 来源:网络 作者:佚名 阅读:次
文章正文:
在access中用WINRAR备份时,发现不能直接备份自己,老是出错,由网友提醒,迂回做到备份自己,各位可以指导以下代码加入自己程序.
'申明
Private Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" _
(ByVal lpExistingFileName As String, ByVal lpNewFileName As String, _
ByVal bFailIfExists As Long) As Long
Private Declare Function DeleteFile Lib "kernel32" Alias "DeleteFileA" _
(ByVal lpFileName As String) As Long
'程序中
Dim Rarexe As String
Rarexe = GetKeyValue(HKEY_LOCAL_MACHINE, "SOFTWARE\Classes\WinRAR\shell\open\command", , REG_SZ)
Rarexe = Mid(Rarexe, 2, InStr(Rarexe, ".exe") + 2)
Dim FileString As String 'Shell指令中的字符串
CopyFile 源文件名, 中间文件名, 0 '0:可以重写
FileString = Rarexe & " A " & 压缩文件名 & " " & 中间文件名
Shell FileString, vbHide
DeleteFile 中间文件名 '删除中间文件名
在access中用WINRAR备份时,发现不能直接备份自己,老是出错,由网友提醒,迂回做到备份自己,各位可以指导以下代码加入自己程序.
'申明
Private Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" _
(ByVal lpExistingFileName As String, ByVal lpNewFileName As String, _
ByVal bFailIfExists As Long) As Long
Private Declare Function DeleteFile Lib "kernel32" Alias "DeleteFileA" _
(ByVal lpFileName As String) As Long
'程序中
Dim Rarexe As String
Rarexe = GetKeyValue(HKEY_LOCAL_MACHINE, "SOFTWARE\Classes\WinRAR\shell\open\command", , REG_SZ)
Rarexe = Mid(Rarexe, 2, InStr(Rarexe, ".exe") + 2)
Dim FileString As String 'Shell指令中的字符串
CopyFile 源文件名, 中间文件名, 0 '0:可以重写
FileString = Rarexe & " A " & 压缩文件名 & " " & 中间文件名
Shell FileString, vbHide
DeleteFile 中间文件名 '删除中间文件名
(责任编辑:admin)
顶一下
(0)
0%
踩一下
(0)
0%
相关内容
最新内容
推荐内容