所以我有这个代码来解压缩一个文件夹:
' Create folder to exctract from, and location of zip file
ExtractTo="\\se-st-file01\" & Right("0" & Year(Date),2) & Right("0" & Month(Date),2) & Right("0" & Day(Date),2) & "\"
Zipfile= "\\se-st-file01\" & Right("0" & Year(Date),2) & Right("0" & Month(Date),2) & Right("0" & Day(Date),2) & "\"& Year(Date) & Right("0" & Month(Date),2) & Right("0" & Day(Date),2) & "file to unzip" & ".Zip"
' Create object for zip file then extract items to set folder above
Set objShell = CreateObject("Shell.Application")
Set FilesinZip=objShell.NameSpace(Zipfile).items
ObjShell.NameSpace(ExtractTo).CopyHere(FilesInZip), &h100
它通常可以工作,但它偶尔会以某种方式出错并选择不提取导致我的代码中的错误进一步下降的所有文件。因此,我想使用7zip程序来提取。
我如何在我的代码中实现它?
答案 0 :(得分:0)
设置oShell = CreateObject(“WScript.Shell”)
oShell.Run(ChrW(34)+“C:\ Program Files(x86)\ 7-Zip \ 7z”+ ChrW(34)+“e”+ LocationOfZipFile +“-aoa -o”+ LocationOfOutput)< / p>