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
- 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.
- Then you could open your Outlook application as usual.
- Next press “Alt + F11” key buttons in the main Outlook window.
- Subsequently, in the Outlook VBA editor, open an empty module.
- 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
- After that, you need to ensure that macro is permitted in your Outlook.
- 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.
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

