Home Outlook How to Delete Attachment from Outlook Email? – Know the Quick Solution...

How to Delete Attachment from Outlook Email? – Know the Quick Solution Here

84
0
SHARE

Outlook is known well for its features and easy to use interface. However, the emails get oversized mainly due to the heavy attachments. This compels the user to delete attachment from Outlook email so as to downsize the email file size.

In some cases, you need to delete a single attachment or delete multiple attachments from Outlook email. In deletion of a single attachment, you just need to select and right click on it.  Then choose ‘Remove attachment’ in order to delete the specific attachment.

In this blog, you will study about how to make deletion of multiple attachments from an email and multiple emails using manual method, Visual Basic for Applications Code and an automated tool.

Automated Solution to Delete Attachment from Outlook Email

You can use PST Compress tool in order to delete Outlook email attachment. This software is easy to use and any novice can easily access it without any complications. It supports all versions of MS Outlook and Windows OS.

download pst compress tool

Steps to delete the attachments from the single or multiple Outlook emails:

Step 1. Launch the compression tool and Add PST files or folder.

add file

Step 2. Click on ‘Browse’ button and select the folder to save the compressed files.

save compressed file

Step 3. Click on ‘Compress PST’ to initiate the compression process.

compress pst

Step 4. Select the option ‘Remove Attachments’ and then click on ‘Compress’.

Delete Attachment from Outlook Email

Step 5. The progress status will be shown on the screen.

compression progress

After the successful compression, you may view the compressed PST files in the destination folder.

Manual Method to Delete Attachment from Outlook Email

1. Select an email message where you want to delete an attachment.

2. Select an attachment so that the ‘Attachment Tools’ get activated.

3. Choose ‘Select All’ in the ‘Attachment Tools’ Tab. This will enable you select all the attachments at once.

4. Click on the ‘Remove Attachment’ in the ‘Attachment Tools’ Tab.

5. A warning box will get opened where you need to click on ‘Remove Attachments’ button.

Limitations of Using Manual Method

  • It is to be noted that ‘Remove Attachment’ is a feature available in Outlook 2010 and the later version but not in Outlook 2007
  • The manual method functions well for single or multiple deletion of attachments in a single email but it may be tedious and time-consuming process for multiple emails

Delete Attachment from Outlook Email via Visual Basic

The following are the steps to delete multiple attachments from Outlook emails:

1. Open Visual Basic for Applications code window.

2. Move to the folder of ‘My Document’, create a new folder and name it as ‘OLAttachments’.

3. Select the emails from where you want to delete the attachments.

4. Open the VBA Editor window using the Alt key and F11 key at the same time.

5. Click on the Project1 then ‘Microsoft Outlook Objects’ followed by ‘ThisOutlookSession’ in the left bar. Hit on ‘ThisOutlookSession’ twice to open it in the Editor.

6. Copy and paste the following VBA code in the VBA Editor.

Public Sub ReplaceAttachmentsToLink()
Dim objApp As Outlook.Application
Dim aMail As Outlook.MailItem ‘Object
Dim oAttachments As Outlook.Attachments
Dim oSelection As Outlook.Selection
DimAs Long
Dim iCount As Long
Dim sFile As String
Dim sFolderPath As String
Dim sDeletedFiles As String
‘Get the path to your My Documents folder    
sFolderPath = CreateObject(“WScript.Shell”).SpecialFolders(16)    
On Error Resume Next        
‘Instantiate an Outlook Application object
Set objApp = CreateObject(“Outlook.Application”)       
‘ Get the collection of selected objects.   
Set oSelection = objApp.ActiveExplorer.Selection        
‘ Set the Attachment folder.   
sFolderPath = sFolderPath & “\OLAttachments”             
‘ Check each selected item for attachments. If attachments exist,   
‘ save them to the Temp folder and strip them from the item.     
For Each aMail In oSelection        
‘ This code only strips attachments from mail items.     
‘ If aMail.class=olMail Then     
‘ Get the Attachments collection of the item.     
Set oAttachments = aMail.Attachments    
 iCount = oAttachments.Count                   
 If iCount > 0 Then                
‘ We need to use a count down loop for removing items from a collection. Otherwise, the loop counter gets confused and only every other item is removed.     
For i = iCount ToStep -1              
Save attachment before deleting from item.           
‘ Get the file name.             
sFile = oAttachments.Item(i).FileName                           
‘ Combine with the path to the Temp folder.            
 sFile = sFolderPath & “\” & sFile                           
‘ Save the attachment as a file.             
oAttachments.Item(i).SaveAsFile sFile                          
‘ Delete the attachment.             
oAttachments.Item(i).Delete                            
‘write the save as path to a string to add to the message            
‘check for html and use html tags in link            
 If aMail.BodyFormat <> olFormatHTML Then            
sDeletedFiles = sDeletedFiles & vbCrLf & “<file://” & sFile & “>”             
Else                 
sDeletedFiles = sDeletedFiles & “<br>” & “<a href=’file://” & _  
sFile & “‘>” & sFile & “</a>”             
End If                                                  
 Next i         
‘End If                       
‘ Adds the filename string to the message body and save it       
 ‘ Check for HTML body      
If aMail.BodyFormat <> olFormatHTML Then     
 aMail.Body = aMail.Body & vbCrLf & _         
“The file(s) were saved to ” & sDeletedFiles       
 Else            
aMail.HTMLBody = aMail.HTMLBody & “<p>” & _           
 “The file(s) were saved to ” & sDeletedFiles & “</p>”   
 End If                
 aMail.Save       
‘sets the attachment path to nothing before it moves on to the next message.  sDeletedFiles = “”             
End If     
Next ‘end aMail
ExitSub:   
Set oAttachments = Nothing
Set aMail = Nothing
Set oSelection = Nothing
Set objApp = Nothing
End Sub

7. Press the F5 key to run this VBA code.

Now, all the attachments from the selected emails get deleted with their hyperlink at the bottom of each selected mails.

Conclusion

In the above blog, the three different methods to delete single or delete multiple attachments Outlook emails or from one email has been explained with steps. It is advisable to go with the expert recommended tool to delete attachment from Outlook email quickly and securely. Or, you can go through each one of them and choose the best that suits to your requirements. 

SHARE
Technical Expert blogger, Love to write about different technologies. Apart from blogging, I like to participate in multiple communities & forums rejoices in assisting troubled users.