Note: The other languages of the website are Google-translated. Back to English
Masuk  \/ 
x
or
x
Daftar  \/ 
x

or

Bagaimana cara mengunduh / menyimpan lampiran secara otomatis dari Outlook ke folder tertentu?

Secara umum, Anda dapat menyimpan semua lampiran dari satu email dengan mengklik lampiran > Simpan Semua Lampiran di Outlook. Tapi, jika Anda perlu menyimpan semua lampiran dari semua email yang diterima dan menerima email, idealnya? Artikel ini akan memperkenalkan dua solusi untuk mengunduh lampiran secara otomatis dari Outlook ke folder tertentu.


Unduh secara otomatis lampiran Outlook ke folder dengan VBA dan aturan

Metode ini akan memperkenalkan skrip VBA, dan menjalankan skrip ini dengan aturan untuk mengunduh dan menyimpan lampiran Outlook secara otomatis ke folder tertentu. Harap lakukan sebagai berikut:

1. tekan lain + F11 kunci untuk membuka jendela Microsoft Visual Basic for Applications.

2. Klik Menyisipkan > Modul, lalu tempelkan skrip VBA di bawah ini ke jendela Modul pembuka yang baru.

VBA: Simpan Otomatis Lampiran Outlook ke folder tertentu

Public Sub SaveAttachmentsToDisk(MItem As Outlook.MailItem)
Dim oAttachment As Outlook.Attachment
Dim sSaveFolder As String
sSaveFolder = "C:\Users\DT168\Documents\outlook-attachments\"
For Each oAttachment In MItem.Attachments
oAttachment.SaveAsFile sSaveFolder & oAttachment.DisplayName
Next
End Sub

Catatan: Silakan cari tahu sSaveFolder = "C: \ Users \ DT168 \ Documents \ outlook-attachments \", dan ganti jalur folder tujuan yang Anda butuhkan.

3. Simpan VBA Script dan tutup jendela Microsoft Visual Basic for Applications.

4. Pergi ke surat lihat, dan klik Home > aturan > Kelola Aturan & Peringatan. Lihat tangkapan layar:

5. Di kotak dialog Rules and Alerts pembuka, klik Aturan baru tombol pada Aturan Email tab. Lihat tangkapan layar:

6. Sekarang di kotak dialog Rules Wizard, klik untuk memilih Terapkan aturan pada pesan yang saya terima pilihan, dan klik Berikutnya tombol.

7. Di kotak dialog Rules Wizard (kondisi mana yang ingin Anda periksa?), Hapus centang opsi apa pun, dan klik Berikutnya tombol. Dan kemudian klik ya di kotak dialog Microsoft Outlook yang muncul. Lihat tangkapan layar:

8. Sekarang di kotak dialog Rules Wizard (apa yang ingin Anda lakukan dengan pesan?), Silakan: (1) Periksalah menjalankan skrip pilihan; (2) Klik teks sebuah naskah untuk membuka kotak dialog Select Script, pilih script yang kami tambahkan pada Langkah 2 dan klik OK tombol; (3) klik Berikutnya tombol.

9. Di kotak dialog Wizard Aturan (Apakah ada pengecualian?), Klik Berikutnya tombol secara langsung.

10. Sekarang di kotak dialog Wizard Aturan terakhir, beri nama aturan di Langkah 1 kotak, centang opsi yang Anda butuhkan di Langkah 2 bagian, dan klik selesai tombol.

11. Tutup kotak dialog Rules and Alerts.

Dan sekarang semua lampiran diunduh dari akun email Anda dan disimpan ke folder tujuan yang ditentukan. Dan semua lampiran email masuk akan secara otomatis diunduh dan disimpan ke folder yang ditentukan juga.


Unduh secara otomatis lampiran Outlook ke folder dengan Kutools for Outlook

Jika Anda menginstal Kutools for Outlook, Anda dapat menerapkannya Lepaskan Otomatis pilihan untuk secara otomatis mengunduh semua lampiran Outlook dan menyimpan ke folder tertentu dengan mudah.

Kutools untuk Outlook: Tambahkan lebih dari 100 alat praktis untuk Outlook, gratis untuk dicoba tanpa batasan dalam 60 hari. Baca Selengkapnya      Uji Coba Gratis Sekarang

1. Klik Kutools > Lepaskan Otomatis > memungkinkan untuk mengaktifkan fitur Auto Detach.

2. Silakan klik Kutools > Lepaskan Otomatis > Manajer Lepas Otomatis.

3. Dalam dialog Auto Detach Attachments, centang Lepaskan otomatis semua lampiran yang diterima opsi, dan kemudian konfigurasikan sebagai berikut:
(1) Klik tombol jelajah  untuk menentukan folder tujuan untuk menyimpan lampiran yang terlepas secara otomatis;
(2) Ini opsional untuk diperiksa Buat subfolder dengan gaya berikut opsi, lalu pilih satu gaya subfolder dari daftar drop-down di bawah ini;
(3) Ini opsional untuk diperiksa satu-satunya lepaskan lampiran dengan ekstensi berikut opsi, dan kemudian ketik ekstensi file lampiran ke dalam kotak di bawah ini;
(4) Ini opsional untuk diperiksa ikon Lampiran masih ada di email Pilihan.

Catatan: Jika Anda perlu melepaskan lampiran secara otomatis oleh pengirim, Anda dapat memeriksa Lepaskan lampiran secara otomatis berdasarkan aturan pilihan, klik Baru tombol, lalu ketikkan alamat email pengirim dan tentukan folder tujuan di dialog kedua Lepaskan Otomatis Lampiran.

4. klik Ok tombol untuk menyimpan pengaturan.

Mulai sekarang, semua lampiran (atau lampiran dengan ekstensi file tertentu, atau lampiran dari pengirim tertentu berdasarkan pengaturan Anda) akan disimpan secara otomatis.

Catatan: Anda dapat menerapkan Kutools for Outlook's Lepaskan Semua Fitur (Lampiran) atau Simpan semua Fitur (Lampiran) untuk mengunduh / menyimpan semua lampiran dengan cepat dari beberapa / semua email yang diterima di Outlook.


Demo: Secara otomatis mengunduh lampiran Outlook ke folder dengan Kutools for Outlook


jenis: Dalam video ini, Kutools tab ditambahkan oleh Kutools untuk Outlook. Jika Anda membutuhkannya, silakan klik detail memiliki uji coba gratis 60 hari tanpa batasan!


Artikel terkait:


Kutools for Outlook - Menghadirkan 100 Fitur Canggih ke Outlook, dan Membuat Pekerjaan Lebih Mudah!

  • CC / BCC Otomatis dengan aturan saat mengirim email; Maju Otomatis Beberapa Email secara khusus; Balas otomatis tanpa server pertukaran, dan lebih banyak fitur otomatis ...
  • Peringatan BCC - tunjukkan pesan ketika Anda mencoba membalas semua jika alamat email Anda ada di daftar BCC; Ingatkan Saat Lampiran Hilang, dan lebih banyak fitur pengingat ...
  • Balas (Semua) Dengan Semua Lampiran di percakapan surat; Balas Banyak Email dalam hitungan detik; Tambah Salam Otomatis saat membalas; Tambahkan Tanggal ke dalam subjek ...
  • Alat Lampiran: Kelola Semua Lampiran di Semua Email, Lepaskan Otomatis, Kompres Semua, Ganti Nama Semua, Simpan Semua ... Laporan Cepat, Hitung Email yang Dipilih...
  • Email Sampah yang Kuat dengan kebiasaan; Hapus Duplikat Email dan Kontak... Memungkinkan Anda melakukan lebih cerdas, lebih cepat, dan lebih baik di Outlook.
shot kutools outlook tab kutools 1180x121
shot kutools outlook kutools plus tab 1180x121
 

Say something here...
symbols left.
You are guest
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    JoaoAzevedo · 3 days ago
    Hi,
    The script works very well.
    Public Sub SaveAttachmentsToDisk(MItem As Outlook.MailItem)
    Dim oAttachment As Outlook.Attachment
    Dim sSaveFolder As String
    sSaveFolder = "C:\Users\DT168\Documents\outlook-attachments\"
    For Each oAttachment In MItem.Attachments
    oAttachment.SaveAsFile sSaveFolder & oAttachment.DisplayName
    Next
    End Sub

    Everything works great but what if I have a number of attachments in the email and I only want to save the excel and pdf files which are attached and not all the files attached to the email?
    Does someone can help?
    Much appreciated.
    Joao
  • To post as a guest, your comment is unpublished.
    Hari · 3 months ago
    @Tom Hi Tom, I'm also facing the same problem..is that fixed for you??

  • To post as a guest, your comment is unpublished.
    GuestMas · 6 months ago
    @Brandie Public Sub SaveAttachmentsToDisk(MItem As Outlook.MailItem)
    Dim oAttachment As Outlook.Attachment
    Dim sSaveFolder As String
    MsgBox "E:\Dropbox\Apps\Attachments" & F
    sSaveFolder = "E:\Dropbox\Apps\" & Format(Now(), "dd.mm_hh.mm.ss")
    For Each oAttachment In MItem.Attachments
    oAttachment.SaveAsFile sSaveFolder & oAttachment.DisplayName
    Next
    End Sub
  • To post as a guest, your comment is unpublished.
    filng · 10 months ago
    @Shilpa Hi Shilpa. At colabel we are developing a no-code solution that can automatically categorize and store your attachments into folders. We're currently looking for qualified beta users willing to test our solution for free. In case you think we might help you, just send me an email at filippo@colabel.com
  • To post as a guest, your comment is unpublished.
    Shilpa · 1 years ago
    @Brandie HI All, I did all the steps but my script is not working.
  • To post as a guest, your comment is unpublished.
    Brandie · 1 years ago
    I got the script to run, everything works, but is there anyway to prevent the original email from being deleted? It is going directly into my "permanently deleted" files. I'd like the emails to stay right where they are rather than being deleted.

  • To post as a guest, your comment is unpublished.
    nilima · 1 years ago
    @cheunt2@gmail.com thank you so much! This solved my problem. Script was not running at all!
  • To post as a guest, your comment is unpublished.
    TGG · 1 years ago
    @jahangir because of security rules thisis not standard active from outlook 2013 and later.

    For outlook 2016 you need to add this to the registry:

    HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\Security
    DWORD: EnableUnsafeClientMailRules
    Value: 1
  • To post as a guest, your comment is unpublished.
    jahangir · 1 years ago
    i am not find "run a script" option please?
  • To post as a guest, your comment is unpublished.
    kellytte · 1 years ago
    @Sipho Hi sipho,
    If you enable the Auto Save Attachments or Auto Detach Attachments feature of Kutools for Outlook, they will save or detach attachments automatically from new incoming emails only when Outlook is running,
  • To post as a guest, your comment is unpublished.
    Joon Lin Ng · 1 years ago
    @cheunt2@gmail.com Thank you very much..
  • To post as a guest, your comment is unpublished.
    Sipho · 1 years ago
    Hi,


    Does Kutools automatically save the emails even when outlook is not opened and if not how can I do this?


    Thanks
  • To post as a guest, your comment is unpublished.
    Aftab · 1 years ago
    @cuatro2006@gmail.com HI, I need the entire timestamp in the file name to be saved as i am recieving the attachment everyhour
  • To post as a guest, your comment is unpublished.
    kellytte · 1 years ago
    @Guil Hi Guil,
    If you use the Detach All (Attachments) of Kutools for Outlook, you can specify to place the attachments into subfolders which are named as message subject-receive time.
  • To post as a guest, your comment is unpublished.
    Guil · 1 years ago
    Hi,

    How can I save this with a timestamp in the file name? The files I receive via e-mail always have the same name and the newer file overrides the previous one.

    Thanks in advance.

    Guil
  • To post as a guest, your comment is unpublished.
    Frodo · 1 years ago
    @Suz I was having the same problem, and enabling all macros fixed it for me as well.
  • To post as a guest, your comment is unpublished.
    Roberta · 2 years ago
    @kellytte Hi,
    I have retored the Run a script option in Outlook. But it still doesen't work. the message error is "This rule is not available in the current mode". Can you help me please?
  • To post as a guest, your comment is unpublished.
    Anthony · 2 years ago
    Hello, this code is running but MItem.Attachments.Count shows 0. When i try in debug mode watch this variable it reread and value shows more than 1. Help please. Why the variable didn't read in automatic mode?
  • To post as a guest, your comment is unpublished.
    kellytte · 2 years ago
    @Krishnakant Hi Krishnakant,
    In this article, I have introduced the method to restore the Run a script option in Outlook. Hope it can help you.
    https://www.extendoffice.com/documents/outlook/4640-outlook-rule-run-a-script-missing.html
  • To post as a guest, your comment is unpublished.
    Krishnakant · 2 years ago
    Hello,

    Its not showing 'run a script' action. Can you help please?


    Thanks

    Krishnakant
  • To post as a guest, your comment is unpublished.
    Katagihallimath · 2 years ago
    Is this correct?

    Public Sub SaveAttachmentsToDisk(MItem As Outlook.MailItem)
    Dim oAttachment As Outlook.Attachment
    Dim sSaveFolder As String
    sSaveFolder = "D:\Adarsh\My\Payslips\" & Year(Date)Format(Date, "DD") & Format(Date, "Mmm")
    For Each oAttachment In MItem.Attachments
    oAttachment.SaveAsFile sSaveFolder & oAttachment.DisplayName
    Next
    End Sub
  • To post as a guest, your comment is unpublished.
    Tom · 2 years ago
    My Computer will only download the attachments when I run the rule manually. it doesn't automatically download the attachments when new emails arrive. Is that how it is supposed to be or could I have something set up wrong?
  • To post as a guest, your comment is unpublished.
    Katagihallimath · 2 years ago
    Hello, I tried downloading the attachments to a folder but the code doesn't seem to work.

    Kindly Help.

    Public Sub SaveAttachmentsToDisk(MItem As Outlook.MailItem)
    Dim oAttachment As Outlook.Attachment
    Dim sSaveFolder As String
    sSaveFolder = "D:\Adarsh\My\Payslips\" & Year(Date)Format(Date, "DD") & Format(Date, "Mmm")
    For Each oAttachment In MItem.Attachments
    oAttachment.SaveAsFile sSaveFolder & oAttachment.DisplayName
    Next
    End Sub
  • To post as a guest, your comment is unpublished.
    Namig Heydarov · 2 years ago
    Hi all,
    I've running a command, but after restart of Outlook it stops. Do you have any idea how to solve it?
    Thanks!
  • To post as a guest, your comment is unpublished.
    James · 2 years ago
    Hi. Is it possible to save just the pdf files from the outlook attachment?
  • To post as a guest, your comment is unpublished.
    cuatro2006@gmail.com · 2 years ago
    @Scott Hi, try whith this

    Path = "\\myfolder\folder1\"
    nombre = "filename"
    fecha = Year(Date) & Format(Month(Date), "00") & Format(Day(Date) , "00")
    olItem.Attachments(1).SaveAsFile Path & nombre & fecha & ".txt"
  • To post as a guest, your comment is unpublished.
    cuatro2006@gmail.com · 2 years ago
    @Alex Hi, show me the script, maybe I can help you
  • To post as a guest, your comment is unpublished.
    Alex · 2 years ago
    I wrote the script but no files are saving to my folder. Any suggestions?
  • To post as a guest, your comment is unpublished.
    Scott · 2 years ago
    Is there a way to modify the file name to include the date (ie: Filename.Date.filetype)
  • To post as a guest, your comment is unpublished.
    cuatro2006@gmail.com · 2 years ago
    Hello!
    I need that if the attachment is empty, that the macro left does not perform any action
  • To post as a guest, your comment is unpublished.
    Martin · 2 years ago
    In option 1, where am I supposed to hit ALT + F11? I tried with Outlook opened and it isn't working. Normal ALT + F11 does nothing, and ALT Gr + F11 opens my Intel HD Graphic Control Panel.
  • To post as a guest, your comment is unpublished.
    Rob · 2 years ago
    Has anyone been able to figure out a way for this to work if the files you are saving all have the same name?


    I get a bunch of files that I need to save daily, but there are at least 2 of each with the same name.


    If anyone has any suggestions that would be greatly appreciated!!
  • To post as a guest, your comment is unpublished.
    Jasmin Nolasco · 2 years ago
    @Alfredo Funes https://www.extendoffice.com/documents/outlook/4640-outlook-rule-run-a-script-missing.html
  • To post as a guest, your comment is unpublished.
    Almira · 2 years ago
    Can I save attachments from 1 category in my email box? I don't need all of them, so I need select it. I have trial version of Kutools and in Options I have just 3 tabs: General, Detach&save and Compress. I saw on the page, that you have tab Filter. So Can I select and make settings from which category to save attachments?
  • To post as a guest, your comment is unpublished.
    Almira · 2 years ago
    @kelly.extendoffice@gmail.com Hi! Did you finish with this project? I mean do you have new version which can do 1) and 2) steps? I need save attachments from 1 category in email box, I don't need all of attachments.
  • To post as a guest, your comment is unpublished.
    Alfredo Funes · 3 years ago
    what if "Run a Script" is not available in "What do you want to do with the message" section?
  • To post as a guest, your comment is unpublished.
    Raynardo Pardo · 3 years ago
    Hello, Is there a VBA script for CSV attachment. I currently have report jobs that automatically goes into named folders in outlook I would now like for those files in the folders extract itself and go into the corresponding folders on my desktop. Hope this makes sense. Please Help! I am very new to VBA.
  • To post as a guest, your comment is unpublished.
    Dan · 3 years ago
    Hello, a few questions:

    1) This software not only saves the attachments but also the email message itself as a png file correct?
    2) This software will let us save each new email in a new subfolder if we set it up correct?
    3) This software will let us set up filters to control which emails get sent to dropbox and which ones are passed on correct?

    Thank You!
  • To post as a guest, your comment is unpublished.
    maxgiaco01@gmail.com · 3 years ago
    Hi, if you need to manage widely the attachments this solution is the best, but if you own a Dropbox account there are some email providers that automatically upload every attachment to Dropbox account. It means that you get the attachment in dropbox folder even if you hadn't read the email. I use servermx.com because they did a customization about the Dropbox path where I need to put the attachments.
  • To post as a guest, your comment is unpublished.
    faitharces29@gmail.com · 3 years ago
    Hi there,

    After having gone through all the steps it does work. The only thing is that while it saves the message as a png file, I would also like the script to actually go to the link in the message and download the data from there. Any good ideas how to extend the script?

    Thanks,

    Laszlo
  • To post as a guest, your comment is unpublished.
    Suz · 3 years ago
    @regis.saintgirons@gmail.com Hi, had a problem with it as well. For me, it were the Outlook settings under Trust Centre. All macros had been disabled. Once I enabled the macros to run on outlook, the script appeared to run and save the file.
  • To post as a guest, your comment is unpublished.
    kelly001 · 3 years ago
    @regis.saintgirons@gmail.com Hi Regis,
    It's hard to figure out the problem. What about trying Kutools for Outlook’s Automatically Detach feature? This feature only requires you to check one options, and all attachments will be automatically downloaded to the specified folder in futre!
  • To post as a guest, your comment is unpublished.
    regis.saintgirons@gmail.com · 3 years ago
    @regis.saintgirons@gmail.com I should add that I am using a gmail inbox
  • To post as a guest, your comment is unpublished.
    regis.saintgirons@gmail.com · 3 years ago
    I need help please !

    I have implemented the rule and the macro as explained. I have even added a msgbox line to make sure that all was ok and it is as the mail subject is properly displayed but the attachement is not saved

    Public Sub SaveAttachmentsToDisk(MItem As Outlook.MailItem)
    Dim oAttachment As Outlook.Attachment
    Dim sSaveFolder As String
    MsgBox "Mail Subject: " & MItem.Subject
    sSaveFolder = "C:\Users\regis\Documents\Attach\"
    For Each oAttachment In MItem.Attachments
    oAttachment.SaveAsFile sSaveFolder & oAttachment.DisplayName
    Next
    End Sub


    What am I doing wrong?
  • To post as a guest, your comment is unpublished.
    kelly.extendoffice@gmail.com · 3 years ago
    @Lahiri Shuvo Hi Lahiri,
    Kutools for Outlook has released the Detach All feature, and you can easily save all attachments in the specified mail folder by the new Detach All feature.
  • To post as a guest, your comment is unpublished.
    kelly.extendoffice@gmail.com · 3 years ago
    @judith Hi Judith,
    Do you mean only save the attachments? Kutools for Outlook’s Detach All feature is designed to save all attachments from multiple emails.
  • To post as a guest, your comment is unpublished.
    kelly.extendoffice@gmail.com · 3 years ago
    @judith In the lastest version of Outlook, the "run a script" option is removed from the Outlook rules. You can follow the method in this article to restore it: https://www.extendoffice.com/documents/outlook/4640-outlook-rule-run-a-script-missing.html
  • To post as a guest, your comment is unpublished.
    Lahiri Shuvo · 3 years ago
    With the VBA script, it's running perfectly for the whole mailbox but I just need to save attachments form a specific folder. Can anyone help me ?
  • To post as a guest, your comment is unpublished.
    judith · 3 years ago
    guys i want to save only documents not the email
  • To post as a guest, your comment is unpublished.
    judith · 3 years ago
    i am failing to get "run the script" in the rules wizard.