VBA用shell命令来压缩文件
Sub zipFile()
Dim winrarPath$, fullname$, filename$, filePath
winrarPath = "c:\program files\winrar\winrar.exe a -afzip "
filePath = Application.GetOpenFilename
If filePath <> False Then
fullname = StrReverse(Split(StrReverse(filePath), "\")(0))
filename = Split(fullname, ".")(0)
Shell winrarPath & filename & " " & fullname
End If
End Sub
注:此代码只能压缩单个文件。压缩多个文件的需要传入一个压缩后的文件名,代码也差不多,不难,大家想想也就出来了。
作者:laoyebin(Paladin.lao)
出处:http://www.cnblogs.com/laoyebin/
网赚 :https://laoyebin.com/
优惠码发布:https://yhmfb.com/
导读网:https://daodu.co/
外汇吧:https://waihui.pub/
本文版权归作者和博客园共有,欢迎转载,但请保留作者信息和原文链接,非常感谢。

浙公网安备 33010602011771号
反馈文章质量,你可以通过快速通道评论: