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

지금 공유 :

In general, to unrar the “.rar” attachments in an email, you should firstly save it and then use specific tool to extract internal files. This article will provide you a method to unrar directly in Outlook.

Outlook doesn’t permit you to preview the “.RAR” attachments. Also, you cannot unrar the “.RAR” attachments straightly within Outlook. Therefore, if you wish to view such an attachment, you should firstly save it to local drive and then extract the internal files from it via special utility, such as WinRAR. Focused on this issue, here we will offer you a way, which allows you to unrar “.RAR”첨부 파일은 Outlook에만 있습니다. 이제 자세한 단계와 VBA 코드를 읽으십시오.

수 UnRAR .RAR VBA를 통해 Outlook에서 직접 첨부 파일

수 UnRAR .RAR Outlook에서 직접 첨부 파일

  1. First of all, as this method relies on a specific tool – WinRAR, you should first install it on your PC and make sure where it is mounted.
  2. 그런 다음 평소처럼 Outlook 응용 프로그램을 열 수 있습니다.
  3. 그런 다음 기본 Outlook 창에서 "Alt + F11"키 버튼을 누릅니다.
  4. 그런 다음 Outlook VBA 편집기에서 빈 모듈을 엽니 다.
  5. 그리고 다음 VBA 코드를이 모듈에 복사합니다.
Public objFileSystem As Object
Public strTempFolder As String
Public strTargetFolderPath As String
Public objAttachment As Outlook.Attachment

Sub UnRARAttachment()
    Dim objMail As Outlook.MailItem
    Dim objShell As Object
    Dim strTempFolder As String
    Dim strRARFile As String
 
    Set objMail = Outlook.Application.ActiveInspector.CurrentItem
 
    Set objFileSystem = CreateObject("Scripting.FileSystemObject")
    strTempFolder = objFileSystem.GetSpecialFolder(2).Path
    strTargetFolderPath = strTempFolder & "\Temp " & Format(Now, "YYYY-MM-DD-hh-mm-ss")
    MkDir (strTargetFolderPath)
 
    Set objShell = CreateObject("Wscript.Shell")
 
    If objMail.attachments.Count > 0 Then
       For Each objAttachment In objMail.attachments
           If LCase(Right(objAttachment.FileName, 4)) = ".rar" Then
 
              strRARFile = strTempFolder & "\" & objAttachment.FileName
              objAttachment.SaveAsFile (strRARFile)
 
              'Change "C:\Program Files\WinRAR\WinRAR.exe" to the location where your WinRAR is installed
              objShell.Run Chr(34) & "C:\Program Files\WinRAR\WinRAR.exe" & Chr(34) & " e " & Chr(34) & strRARFile & Chr(34) & " " & Chr(34) & strTargetFolderPath & Chr(34)
           End If
       Next
    End If
 
End Sub

Sub AttachExtractedFiles()
    Dim strFolderPath As String
    Dim strFile As String
 
    'Attach the extracted files to the current email
    strFolderPath = strTargetFolderPath & "\"
    strFile = Dir(strFolderPath)
 
    Set objMail = Outlook.Application.ActiveInspector.CurrentItem
 
    While Len(strFile) > 0
          objMail.attachments.Add strFolderPath & strFile
          strFile = Dir
    Wend
 
    'Delete the .RAR attachments
    For Each objAttachment In objMail.attachments
        If LCase(Right(objAttachment.FileName, 4)) = ".rar" Then
           objAttachment.Delete
        End If
    Next
End Sub

VBA Code - Unrar .RAR Outlook에서 직접 첨부 파일

  1. 그런 다음 Outlook에서 매크로가 허용되는지 확인해야합니다.
  2. 마지막으로 시도해 볼 수 있습니다.
  • Firstly, open an email which contains .RAR 첨부 파일.
  • 그런 다음 새 매크로 버튼으로 돌아갑니다.
  • Click into “UnRARAttachments” subroutine and press F5.
  • 그리고 다음 "AttachExtractedFiles"서브 루틴을 클릭하고 F5 키를 누릅니다.
  • After that, you can turn back to the mail window. You will see that .RAR 첨부 파일이 압축 해제되었습니다. 추출 된 모든 파일이 첨부되었습니다.수 UnRAR RAR 첨부 파일

압축 해제 .Zip Outlook의 첨부 파일

Like decompressing the .RAR attachments, Outlook doesn’t have native features to decompress the “.zip” attachments. Therefore, if you’re unable to directly unzip the “.Zip”첨부 파일은 기본적으로 Outlook에 그대로 있습니다. 다행히도 Outlook VBA를 사용하여이 기능을 수행 할 수 있습니다. 자세한 내용은 이전 기사를 확인하세요.“How to Unzip the .Zip VBA를 통해 Outlook에서 직접 첨부 파일".

저자 소개 :

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

지금 공유 :

댓글이 닫혀있다.