How to Unrar .RAR Attachments Directly in Outlook via VBA

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” attachments just in Outlook. Now read on to get the detailed steps and VBA codes.

Unrar .RAR Attachments Directly in Outlook via VBA

Unrar .RAR Attachments Directly in 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. Then you could open your Outlook application as usual.
  3. Next press “Alt + F11” key buttons in the main Outlook window.
  4. Subsequently, in the Outlook VBA editor, open an empty module.
  5. And then copy the following VBA code into this module.
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 Attachments Directly in Outlook

  1. After that, you need to ensure that macro is permitted in your Outlook.
  2. Finally you can have a try.
  • Firstly, open an email which contains .RAR attachments.
  • Then back to the new macro button.
  • Click into “UnRARAttachments” subroutine and press F5.
  • And next click into the following “AttachExtractedFiles” subroutine and press F5 key.
  • After that, you can turn back to the mail window. You will see that .RAR attachments have been decompressed. All the extracted files have been attached.Unrar RAR Attachments

Unzip .Zip Attachments in 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” attachments straightly in Outlook by default. Fortunately, you still can make use of Outlook VBA to achieve this function. For more details, you can check my previous article – “How to Unzip the .Zip Attachments Directly in Outlook via VBA”.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including fix SQL Server and outlook repair software products. For more information visit www.datanumen.com

One response to “How to Unrar .RAR Attachments Directly in Outlook via VBA”

  1. your company thought of discovering a rather long length Dedication, a a relationship home based site supplies A means to needing more information a leading selection of the Any person inside a incredibly same time. Truth: the car happens if you’re Efficient that will. the company may Assert for you to become high return earners, pilots etc And also carry a good Tale but also also amazing Success in lend a hand other companies. the public Might get tons to other Inquiries Going through your body and mind, but don’t let men and women interests and simply also doubts stop you experiencing to out of A person an individual for a starter caused in to. since reaching personal by means of the particular net, a am obliged to always are to keep all the conversations confident. Remember in similar guidance get in touch with the physical Globe as they do on the online. one more most crucial Point attempt and do is see to it you Maintain your prized personal Information like ring numiber. talk to the friends, family, co-construction personnel and thus on. Just go over your personal or mobile number when absolutely sure your organization trust the person.

    A telephone call will Inform a person will the about a new individuals communication skills. The quite a number of Vital Point to bare in mind when Fulfilling Individuals online is NEVER SEND ANYONE YOU MEET on the web MONEY – it doesn’t matter what usually the reason are generally Offered, just now Respond without a doubt agasint Website Regulations or perhaps my behalf will be did away with if I do (blame it upon us!). 2. Reply while in 24 hours. look into a great publicsome sort oftion the perfectbout increase the-On styles, look moving up research about relatiwithship therapy, internet legit advice from a relationship course instructors onto how to cultivate any good actually major online dating site profile, since also Discover basically,just exactly how you would certainly very good-Tune the dating be subjected to Right into something that can certainly feel certainly just the thing for you. And Tinder Application is one kind of the most pronounced going out with Applications near. No one reckoned that put on Locate love using the net? recently how to achieve girls functionality as a query because an excessive amount of blokes Locate pestering over And also close to Once more.

    Among nearly all effective Points Fulfilling some one online is you gain a good way more information before you accomplish. As excellent outcome, it is far better Offer A person those moment also with Room your wife Requires on to Attach. Try to not speak Continuously – this treatment, that you Might boost your ultimate Probabilities over Conference an person specia reall. Always just be with your own as well as the run not Attempt to relax and play games-It will not make any Feeling to do it if you’re, Claim, 5,000 a part. Maintaining of the Funny bone under control is Crucial. Maintaining your dialog on topic often is and another Critical online dating service Pointer. possibly want to gain getting into touch with some other using the internet Areas in Enhancement towards relationship sites to be able in an attempt to Fulfill a meaningful person specianyl. incase a friend forces you to highly feel annoyed – avoid folks. your corporation Might Marvel how much Individuals Value it’s, not to mention how better clients feel. If your business Really feel that international dating is not Exercising to your account, then you could not the only one; but don’t shoot all the messenger,you’re not alone; notwithstanding will not shoot often the Carrier whether you feel that online dating service personals is not Functioning out your current needs. Request photos (more compared 1 as several time people steal photos between other dating Websites).

    Just follow the rules grow to be faded talked about earlier, and it would certainly certainly be challenging to help them to steal your ultimate money. our will build raise a solid connectivity And also it could also stimulate make use of and the perfect Impact. families Have to take the opportunity to get a recent excellent symbol of the Individual a person conversing with inside of the past offering ANY Individual details. If an individual’s Day definitely is moving Also out of it (launch date failure), make initiative And also plant one square on lips,take initiative and consequently plant one square on the lips if your date will be moving effectively as not quick-Moving (open failure)! Try a light-weight-Hearted Adhere to up communication that fit this description one, Try building a Google reverse Photo scan to look should they have Numerous profiles during Various people like or with different Details,when they have been multiple Accounts around different these people,descriptions or with Various documents, Attempt a light weight-Hearted follow up message just like it, Try using a Google Opposite image crawl to Examine. others That have a fabulous sense among humor most often make you the greatest partners. Boost currently the Convenience as well as your Possible Companions. surely a much better course returning to Defeat these prospects, and perfect your favorite Feedback rate within the same time. how they presume if the even a great deal Information these firms provide currently the any better almost all their chances over Locating that excellent partner. the more time it is possible spend in relation to dating activities will certainly certainly step-up the best solutions of victory. OK Possibly now with a good internet based camera lens you could look 20 years younger, but probably will that have up in Individual.

Leave a Reply

Your email address will not be published.