Loncat ke daftar isi utama

Bagaimana cara menghapus semua lampiran dari email di Outlook?

Biasanya saat Anda melihat pratinjau email, Anda dapat menghapus lampiran dengan mengklik kanan dan memilih Hapus Lampiran barang. Terkadang mungkin ada banyak lampiran dalam pesan email, dan akan membosankan untuk menghapusnya satu per satu. Di sini kami mengatur Anda dengan dua trik mudah untuk menghapus semua lampiran dalam satu email, dan menghapus semua lampiran dari beberapa email juga di Outlook.

Hapus semua lampiran secara manual dalam satu pesan email di Outlook
Hapus semua lampiran dari beberapa pesan email di Outlook dengan kode VBA
Hapus semua lampiran dengan mudah dari satu atau beberapa email dengan Kutools for Outlook


Hapus semua lampiran secara manual dalam satu pesan email di Outlook

Mudah untuk menghapus semua lampiran di pesan email yang dipilih dengan Hapus Lampiran fitur di Outlook.

Langkah 1: Pilih pesan email yang lampirannya akan Anda hapus nanti.

Langkah 2: Klik salah satu lampiran di Panel Baca untuk mengaktifkan Alat Lampiran.

Langkah 3: Klik Select All tombol di Seleksi kelompok di lampiran Tab.

Langkah ini akan memungkinkan Anda untuk memilih semua lampiran di pesan email yang dipilih ini sekaligus.

Langkah 4: Klik Hapus Lampiran tombol di tindakan kelompok di lampiran Tab.

Langkah 5: Di kotak dialog peringatan, klik Hapus Lampiran .

Kemudian semua lampiran dalam pesan email yang dipilih ini dihapus secepatnya.

Note: Fitur Hapus Lampiran berfungsi dengan baik di Outlook 2010 dan versi yang lebih baru, tetapi tidak di Outlook 2007.


Hapus semua lampiran dengan mudah dari beberapa email yang dipilih di Outlook:

Dengan Lepaskan Semua lampiran kegunaan Kutools untuk Excel, Anda dapat dengan mudah menghapus semua lampiran dari beberapa email yang dipilih seperti yang ditunjukkan pada demo di bawah ini. (Lampiran akan disimpan ke dalam folder tertentu) Unduh dan coba sekarang! (Jejak gratis 30 hari)


Hapus semua lampiran dari beberapa pesan email di Outlook dengan kode VBA

Jika Anda ingin menghapus semua lampiran dari beberapa pesan email di Microsoft Outlook, metode berikut akan membantu Anda melakukannya dengan mudah. Kami merekomendasikan Anda aktifkan semua makro di Microsoft Outlook Anda pertama.

Langkah 1: Buka folder Dokumen Saya, buat folder baru, dan beri nama sebagai Lampiran OLA

Langkah 2: Pilih beberapa pesan email yang lampirannya akan Anda hapus nanti.

Catatan: Anda dapat memilih pesan email yang tidak berurutan dengan menahan Ctrl kunci dan klik.

Anda dapat memilih pesan email berturut-turut dengan menahan perubahan kunci dan klik.

Langkah 3: Buka VBA Editor dengan menekan lain kunci dan F11 kunci pada saat bersamaan

Langkah 4: Perluas file Project1 > Objek Microsoft Outlook di bilah kiri, lalu klik dua kali Sesi Pandangan ini untuk membukanya di Editor. Lihat tangkapan layar berikut:

Langkah 5: Salin dan tempel kode VBA berikut di panel pengeditan.

Public Sub ReplaceAttachmentsToLink()
Dim objApp As Outlook.Application
Dim aMail As Outlook.MailItem 'Object
Dim oAttachments As Outlook.Attachments
Dim oSelection As Outlook.Selection
Dim i As 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 To 1 Step -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

Langkah 6: Tekan tombol F5 untuk menjalankan kode VBA ini.

Sekarang semua lampiran dari pesan email yang dipilih dihapus, dengan meninggalkan hyperlink ke setiap lampiran yang dihapus di bagian bawah semua pesan email yang dipilih.


Hapus semua lampiran dengan mudah dari satu atau beberapa email dengan Kutools for Outlook

Grafik Lepaskan Semua utilitas lampiran Kutools untuk Outlook dapat dengan cepat menghapus semua lampiran dari satu atau beberapa email yang dipilih di Outlook. Silakan lakukan sebagai berikut.

Kutools untuk Outlook : dengan lebih dari 100 add-in Outlook yang berguna, bebas untuk mencoba tanpa batasan dalam 60 hari.

1. Pilih satu atau beberapa pesan email dengan lampiran yang ingin Anda hapus, lalu klik Kutools > Alat LampiranLepaskan Semua. Lihat tangkapan layar:

2. Dalam Lepaskan Pengaturan kotak dialog, konfigurasikan sebagai berikut.

  • 2.1 Klik tombol Browse tombol untuk memilih folder untuk menyimpan semua lampiran yang dihapus.
  • 2.2 Secara default, file Lepaskan lampiran dengan gaya di bawah ini kotak dicentang, pilih opsi untuk menyimpan lampiran ke dalam folder yang berbeda berdasarkan email yang Anda butuhkan.
  • 2.3 Klik tombol OK tombol. Lihat tangkapan layar:

Catatan:
1. Jika Anda ingin menyimpan semua lampiran ke dalam folder yang sama, hapus centang pada Buat subfolder dengan gaya berikut kotak.
2. Setelah menghapus lampiran, ikon lampiran akan hilang dari email milis. Anda dapat memeriksa Ikon lampiran masih tetap ada di email kotak untuk selalu menyimpannya.
2. Selain menghapus semua lampiran dari email yang dipilih, Anda dapat menghapus lampiran hanya dengan kondisi tertentu. Misalnya, Anda hanya ingin menghapus lampiran yang ukurannya lebih dari 500KB, silakan klik Advanced options tombol untuk memperluas kondisi, dan kemudian konfigurasikan seperti gambar di bawah ini yang ditampilkan.

3. Klik Yes tombol di Lepaskan Semua kotak dialog.

4. Kemudian a Kutools untuk Outlook kotak dialog akan muncul untuk memberi tahu Anda berapa banyak lampiran yang dihapus. Silakan klik OK

Sekarang semua lampiran segera dihapus dengan hanya hyperlink yang tersisa di email yang dipilih. Anda dapat mengklik hyperlink untuk membuka lampiran yang sesuai yang Anda butuhkan.

  Jika Anda ingin memiliki uji coba gratis (60 hari) dari utilitas ini, silahkan klik untuk mendownloadnya, lalu lanjutkan untuk menerapkan operasi sesuai langkah di atas.


Alat Produktivitas Kantor Terbaik

Kutools untuk Outlook - Lebih dari 100 Fitur Canggih untuk Meningkatkan Outlook Anda

🤖 Asisten Surat AI: Email profesional instan dengan keajaiban AI--satu klik untuk mendapatkan balasan jenius, nada sempurna, penguasaan multibahasa. Ubah email dengan mudah! ...

📧 Email Otomatis: Di Luar Kantor (Tersedia untuk POP dan IMAP)  /  Jadwal Kirim Email  /  Auto CC/BCC Sesuai Aturan Saat Mengirim Email  /  Penerusan Otomatis (Aturan Lanjutan)   /  Tambah Salam Otomatis   /  Secara Otomatis Membagi Email Multi-Penerima menjadi Pesan Individual ...

📨 email Management: Mengingat Email dengan Mudah  /  Blokir Email Penipuan berdasarkan Subjek dan Lainnya  /  Hapus Email Duplikat  /  Pencarian  /  Konsolidasi Folder ...

📁 Lampiran ProPenyimpanan Batch  /  Pelepasan Batch  /  Kompres Batch  /  Penyimpanan otomatis   /  Lepaskan Otomatis  /  Kompres Otomatis ...

🌟 Antarmuka Ajaib: 😊Lebih Banyak Emoji Cantik dan Keren   /  Tingkatkan Produktivitas Outlook Anda dengan Tampilan Tab  /  Minimalkan Outlook Daripada Menutup ...

👍 Keajaiban sekali klik: Balas Semua dengan Lampiran Masuk  /   Email Anti-Phishing  /  🕘Tampilkan Zona Waktu Pengirim ...

👩🏼‍🤝‍👩🏻 Kontak & Kalender: Batch Tambahkan Kontak Dari Email yang Dipilih  /  Bagi Grup Kontak menjadi Grup Individual  /  Hapus Pengingat Ulang Tahun ...

Lebih 100 Fitur Tunggu Eksplorasi Anda! Klik Di Sini untuk Menemukan Lebih Banyak.

 

 

Comments (33)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hello,
MS recently changed the storage limits for Hotmail. Attachments are counted towards storage used.
Many users would like to remove only the attachments in bulk. Your VBA script may be the solution for these users.
Can you confirm if this script still works for Hotmail users in 2023?
Thank you in advance.
This comment was minimized by the moderator on the site
The article and the comments below are very helpful! Thanks!
This comment was minimized by the moderator on the site
 Hello, I use the VBA code, unfortunaltely all the attachements were deleted from the emails, and they were not storage in any of the folders... so i lost many attachment files. anyone knows how can i restored
This comment was minimized by the moderator on the site
The VBA code shown in solution 2 works fine, however, but my goal is to remove only attachments which are not inline the message. Being VBA ignorant I would like to ask if it is possible to modify the code in that manner it would remove only attached files, not pictures inside the email text. It would surely make my day :)

Thank you in advance
This comment was minimized by the moderator on the site
Can somebody change the code so that only for example attachments named "TermsAndConditions.pdf" are deleted
This comment was minimized by the moderator on the site
Dear Rene,
Please follow the steps in the above second method, run the below VBA code. In an opening dialog box, please enter the attachment's name with the file extension (such as test.docx), and then click the OK button to just remove it from the selected email.

Sub ReplaceAttachmentsToLink()
Dim xMail As Outlook.MailItem
Dim xAttachments As Outlook.Attachments
Dim xSelection As Outlook.Selection
Dim i, xCount As Long
Dim xFile, xFldPath, xDelFiles, xFileName As String
Dim xFlag As Boolean

xFldPath = CreateObject("shell.Application").NameSpace(5).self.Path
On Error Resume Next
Set xSelection = Outlook.ActiveExplorer.Selection
xFldPath = xFldPath & "\OLAttachments"
xFlag = False
xFileName = InputBox("Attachment name:", "Kutools for Outlook")

If StrPtr(xFileName) = 0 Then Exit Sub
If xFileName <> "" Then
For Each xMail In xSelection
Set xAttachments = xMail.Attachments
xCount = xAttachments.Count
If xCount > 0 Then
For i = xCount To 1 Step -1
xFile = xAttachments.Item(i).FileName
If xFileName = xFile Then
xFlag = True
xFile = xFldPath & "\" & xFile
xAttachments.Item(i).SaveAsFile xFile
xAttachments.Item(i).Delete
If xMail.BodyFormat <> olFormatHTML Then
xDelFiles = xDelFiles & vbCrLf & ""
Else
xDelFiles = xDelFiles & "
" & "" & xFile & ""
End If
End If
Next i
If xFlag = True Then
If xMail.BodyFormat <> olFormatHTML Then
xMail.Body = xMail.Body & vbCrLf & "The file(s) were saved to " & xDelFiles
Else
xMail.HTMLBody = xMail.HTMLBody & "
" & "The file(s) were saved to " & xDelFiles & "
"
End If
End If
xMail.Save
xDelFiles = ""
End If
Next
If xFlag = False Then
MsgBox "The Attachment does not exist!"
Else
MsgBox "The attachment has been deleted."
End If
Else
MsgBox "Please input a attachment name"
End If
Set xAttachments = Nothing
Set xMail = Nothing
Set xSelection = Nothing
End Sub
This comment was minimized by the moderator on the site
Method 1 doesn't work here, as there's only 1 option under 'Selection': Copy.
This comment was minimized by the moderator on the site
Dear Peter,
Outlook users are reporting that the Select All (attachments) feature in Outlook 2016 is missing.
This comment was minimized by the moderator on the site
The VBA Code solution was great .... worked beautifully
This comment was minimized by the moderator on the site
Compile Error Sub or Function not defined??
This comment was minimized by the moderator on the site
VBA code worked great. Many thanks!
This comment was minimized by the moderator on the site
Hi This was really helpful , but as all attachments were not saved when i tried again it gives a message "the macros in this project are disabled".....tried enabling macros in outlook but no luck, any one can help! Regards Lisa
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations