'VB调用WinRAR压缩文件,压缩的源文件不能被别的程序占用
Sub ADDRAR()
Dim S1 As String
Dim S2 As String
Dim S3 As String
Dim S As String
S1 = "C:\Program Files\WinRAR\WinRAR.exe" 'winrar安装路径
S2 = "D:\TiancaoCADTools\1.rar" '压缩文件路径
S3 = "D:\TiancaoCADTools" '源文件路径,路径后有"\"和没有的结果是不一样的,没有会压缩子文件夹
S = S1 & " a -inul " & S2 & " " & S3 ' -inul 禁止所有错误消息
'S = S1 & " a -ep -inul " & S2 & " " & S3 '-ep 会取消子文件,将子文件夹下文件全放到根文件夹下面
Shell S, vbHide
End Sub
Sub ADDRAR()
Dim S1 As String
Dim S2 As String
Dim S3 As String
Dim S As String
S1 = "C:\Program Files\WinRAR\WinRAR.exe" 'winrar安装路径
S2 = "D:\TiancaoCADTools\1.rar" '压缩文件路径
S3 = "D:\TiancaoCADTools" '源文件路径,路径后有"\"和没有的结果是不一样的,没有会压缩子文件夹
S = S1 & " a -inul " & S2 & " " & S3 ' -inul 禁止所有错误消息
'S = S1 & " a -ep -inul " & S2 & " " & S3 '-ep 会取消子文件,将子文件夹下文件全放到根文件夹下面
Shell S, vbHide
End Sub
|
暂时没有评论
发表评论 - 不要忘了输入验证码哦! |