압축 해제 방법 .Zip VBA를 통해 Outlook에서 직접 첨부 파일

지금 공유 :

When you receive an attachment in “.zip” file extension, if you want to unzip them, in general, you should save and unzip them in local drive. But many hope to unzip them directly in Outlook. This article will teach you how to get it via VBA.

You must have ever received the attachments which are in “.zip" 파일 확장자. 내부 파일에 액세스하려면 zip file, you have to firstly unzip it. In this case, as usual, you have to first save the zip file to local drive and then right click it and select “Extract All” from the context menu. In reality, many users prefer to unzip the file directly within Outlook. However, Outlook does not provide such a native feature. Fortunately, you can follow the steps thereinafter to utilize VBA to realize it like a breeze.

압축 해제 .Zip VBA를 통해 Outlook에서 직접 첨부 파일

압축 해제 .Zip Outlook에서 직접 첨부 파일

  1. 먼저 Outlook 응용 프로그램을 시작하십시오.
  2. 그런 다음 Outlook 창에서 "Alt + F11"키 바로 가기를 눌러 VBA 편집기에 액세스합니다.
  3. 다음으로 "Microsoft Visual Basic for Applications"창에서 사용하지 않는 모듈을 엽니 다.
  4. 그런 다음 다음 VBA 코드를 복사하여이 모듈에 붙여 넣습니다.
Public Sub UnzipFileInOutlook()
    Dim objMail As Outlook.MailItem
    Dim objAttachments As Outlook.attachments
    Dim objAttachment As Outlook.Attachment
    Dim objShell As Object
    Dim objFileSystem As Object
    Dim strTempFolder As String
    Dim strFilePath As String
    Dim strFileName As String
 
    Set objMail = Outlook.Application.ActiveInspector.CurrentItem
    Set objAttachments = objMail.attachments
 
    'Save & Unzip the zip file in local drive
    Set objShell = CreateObject("Shell.Application")
    Set objFileSystem = CreateObject("Scripting.FileSystemObject")
    strTempFolder = objFileSystem.GetSpecialFolder(2).Path & "\Temp" & Format(Now, "yyyy-mm-dd-hh-mm-ss")
    MkDir (strTempFolder)
 
    For Each objAttachment In objAttachments
        If Right(objAttachment.FileName, 3) = "zip" Then
           strFilePath = strTempFolder & "\" & objAttachment.FileName
           objAttachment.SaveAsFile (strFilePath)
           objShell.NameSpace((strTempFolder)).CopyHere objShell.NameSpace((strFilePath)).Items
        End If
    Next
 
    'Reattach the files extracted from the zip file
    strFileName = Dir(strTempFolder & "\")
 
    While Len(strFileName) > 0
          objMail.attachments.Add (strTempFolder & "\" & strFileName)
          strFileName = Dir
          objMail.Save
    Wend
 
    'Delete the attachments in “.zip” file extension
    Set objAttachments = objMail.attachments
    For Each objAttachment In objAttachments
        If Right(objAttachment.FileName, 3) = "zip" Then
           objAttachment.Delete
           objMail.Save
        End If
    Next
 
    'Delete the temp folder and files
    objFileSystem.DeleteFolder (strTempFolder)
End Sub

VBA Code - Unzip the .Zip Outlook에서 직접 첨부 파일

  1. 그런 다음 평소와 같이 메시지 창의 빠른 실행 도구 모음에 새 VBA 프로젝트를 추가 할 수 있습니다.
  2. 마지막으로 시도해 볼 수 있습니다.
  • 먼저 다음으로 메시지를 엽니 다. zip 자체 창에서 파일.
  • 그런 다음 "작업"> "메시지 편집"을 클릭합니다.
  • 다음으로 빠른 실행 도구 모음에서 새 매크로 버튼을 클릭합니다.
  • 한 번에 zip file will unzipped, like the following screenshot:Unzip File

성가신 PST 문제 제거

새로운 유니 코드 형식의 PST 파일은 20GB 파일 크기를 지원하지만 파일을 가능한 한 작게 유지하는 것이 좋습니다. 큰 PST 파일은 손상되기 훨씬 더 쉽습니다. PST 파일이 손상되면 다음을 위해 노력해야합니다. PST 복구 데이터. 이 시나리오에서는 다음과 같이 잘 입증되고 평판이 좋은 도구로 되풀이 할 수밖에 없습니다. DataNumen Outlook Repair.

저자 소개 :

Shirley Zhang은 데이터 복구 전문가입니다. DataNumen, Inc.는 다음과 같은 데이터 복구 기술 분야의 세계적 리더입니다. SQL 수리 및 전망 수리 소프트웨어 제품. 자세한 내용은 WWW.datanumen.COM

지금 공유 :

댓글이 닫혀있다.