許多用戶希望打印一個壓縮包中的所有文件 zip Outlook 電子郵件的附件,無需麻煩地保存和解壓縮 zip 依戀。 因此,本文將介紹一種更有效的實現方法。
當您想要打印一個 zip 對於附件,您可能習慣於點擊附件圖標,然後點擊功能區中的「快速列印」按鈕。但是,即使這樣,Outlook 仍然會提示您先儲存並解壓縮檔案。如果您想避免這些繁瑣的步驟,可以使用以下 VBA 程式碼。

打印一個中的所有文件 Zip 電子郵件附件
- 首先,啟動 Outlook 應用程式。
- 然後,按照文章中顯示的步驟訪問 Outlook VBA 編輯器 – “如何在Outlook中運行VBA代碼“。
- 接下來,您可以打開“ThisOutlookSession”項目或未使用的模塊。
- 隨後,複製並粘貼下面的 VBA 代碼。
Dim objShell As Object
Dim objFileSystem As Object
Sub PrintAllFilesInZipAttachment ()
Dim objAttachmentSelection As Outlook.AttachmentSelection
Dim objAttachment, objTempAttachment As Outlook.Attachment
Dim strTempFolder As String
Dim strSavingPath As String
Dim objTempMail As Outlook.MailItem
Dim strFileName As String
'Get selected attachment
Set objAttachmentSelection = Outlook.Application.ActiveExplorer.AttachmentSelection
Set objAttachment = objAttachmentSelection.Item(1)
If Right(LCase(objAttachment.filename), 3) = "zip" Then
'Save & Unzip the zip attachment
Set objShell = CreateObject("Shell.Application")
Set objFileSystem = CreateObject("Scripting.FileSystemObject")
strTempFolder = objFileSystem.GetSpecialFolder(2).Path & "\Unzip" & Format(Now, "yyyymmddhhmmss")
MkDir (strTempFolder)
strSavingPath = strTempFolder & "\" & objAttachment.filename
objAttachment.SaveAsFile (strSavingPath)
objShell.NameSpace((strTempFolder)).CopyHere objShell.NameSpace((strSavingPath)).Items
'Attach Unzipped files to a temp mail
Set objTempMail = Outlook.Application.CreateItem(olMailItem)
objTempMail.Display
strFileName = Dir(strTempFolder & "\")
While Len(strFileName) > 0
objTempMail.Attachments.Add (strTempFolder & "\" & strFileName)
strFileName = Dir()
Wend
'Print all attachments of the temp email
Call PrintFiles(objTempMail)
objTempMail.Close olDiscard
objFileSystem.DeleteFolder (strTempFolder)
End If
End Sub
Sub PrintFiles(ByVal objMail As Outlook.MailItem)
Dim objAttachment As Outlook.Attachment
Dim strTempFolder, strFilePath As String
Dim objTempFolder As Object
Dim objTempFolderItem As Object
strTempFolder = objFileSystem.GetSpecialFolder(2).Path & "\TEMP" & Format(Now, "yyyymmddhhmmss")
MkDir (strTempFolder)
'Print all attachments
For Each objAttachment In objMail.Attachments
If Right(LCase(objAttachment.filename), 3) <> "zip" Then
strFilePath = strTempFolder & "\" & objAttachment.filename
objAttachment.SaveAsFile (strFilePath)
Set objShell = CreateObject("Shell.Application")
Set objTempFolder = objShell.NameSpace(0)
Set objTempFolderItem = objTempFolder.ParseName(strFilePath)
objTempFolderItem.InvokeVerbEx ("print")
End If
Next
objFileSystem.DeleteFolder (strTempFolder)
End Sub
- 之後,關閉當前的 VBA 編輯器窗口。
- 稍後,前往 Outlook 選項將新宏添加到快速訪問工具欄。
- 最後,您可以嘗試一下:
- 首先,選擇一個 zip 電子郵件的附件。
- 然後,在快速訪問工具欄中單擊宏。
- 文件立即壓縮到選定的位置 zip 將打印附件。
備份 Outlook 數據文件
您可能已經發現 Outlook 容易出現資料損壞。一旦 Outlook 損壞,您的 Outlook 資料就會遺失。因此,定期備份 Outlook 資料檔案至關重要,這樣您就可以輕鬆地透過備份還原 Outlook 資料。但是,如果您發現備份已經過期數週且無效,那麼您別無選擇,只能求助於可靠且經驗豐富的服務商。 PST恢復 工具,例如 DataNumen Outlook Repair.
作者簡介:
Shirley Zhang是的數據恢復專家 DataNumen,Inc.是數據恢復技術的全球領導者,包括 損壞的MDF 和Outlook修復軟件產品。 欲了解更多信息,請訪問 萬維網。datanumen.COM

