-3
是否有任何VBA代碼的Outlook會自動解壓文件?我找到了幾個將文件保存到locationm的文章,但沒有解壓文件。VBA在Outlook中解壓縮文件
是否有任何VBA代碼的Outlook會自動解壓文件?我找到了幾個將文件保存到locationm的文章,但沒有解壓文件。VBA在Outlook中解壓縮文件
也許this是你在找什麼。從網站的一個例子(訪問鏈接瞭解更多):
有了這個例子中,你可以瀏覽到zip文件。選擇zip文件後,宏將在DefaultFilePath中創建一個新文件夾,並解壓縮該文件夾中的Zip文件。您可以不做任何更改地運行代碼。
Sub Unzip1()
Dim FSO As Object
Dim oApp As Object
Dim Fname As Variant
Dim FileNameFolder As Variant
Dim DefPath As String
Dim strDate As String
Fname = Application.GetOpenFilename(filefilter:="Zip Files (*.zip), *.zip", _
MultiSelect:=False)
If Fname = False Then
'Do nothing
Else
'Root folder for the new folder.
'You can also use DefPath = "C:\Users\Ron\test\"
DefPath = Application.DefaultFilePath
If Right(DefPath, 1) <> "\" Then
DefPath = DefPath & "\"
End If
'Create the folder name
strDate = Format(Now, " dd-mm-yy h-mm-ss")
FileNameFolder = DefPath & "MyUnzipFolder " & strDate & "\"
'Make the normal folder in DefPath
MkDir FileNameFolder
'Extract the files into the newly created folder
Set oApp = CreateObject("Shell.Application")
oApp.Namespace(FileNameFolder).CopyHere oApp.Namespace(Fname).items
'If you want to extract only one file you can use this:
'oApp.Namespace(FileNameFolder).CopyHere _
'oApp.Namespace(Fname).items.Item("test.txt")
MsgBox "You find the files here: " & FileNameFolder
On Error Resume Next
Set FSO = CreateObject("scripting.filesystemobject")
FSO.deletefolder Environ("Temp") & "\Temporary Directory*", True
End If
End Sub