メインコンテンツへスキップ

Outlookから特定のフォルダに添付ファイルを自動的にダウンロード/保存するにはどうすればよいですか?

Outlook で XNUMX つの電子メールからすべての添付ファイルを保存するのは簡単ですが、 添付ファイル > すべての添付ファイルを保存 オプションを使用すると、複数の電子メールの添付ファイル、特に大量の添付ファイルの管理がより困難になる可能性があります。この記事では、Outlook メールの添付ファイルを特定のフォルダーに自動的にダウンロードするための XNUMX つの効果的な解決策を紹介します。これらの方法は、多数の電子メールや添付ファイルを処理する場合に特に便利で、プロセスが簡素化され、時間が節約されます。


VBA とルールを使用して Outlook の添付ファイルをフォルダーに自動的にダウンロードする

このアプローチには、VBA スクリプトの使用が含まれます。このスクリプトは、特定のルールで実行されると、Outlook 電子メールから指定されたフォルダーに添付ファイルを自動的にダウンロードして保存します。次の手順に進んでください。

  1. イベント Altキー+ F11 を開く アプリケーション向け Microsoft Visual Basic 窓。
  2. インセット > モジュール、次に、以下の VBA スクリプトを新しく開いたファイルに貼り付けます。 モジュール 窓。

    VBA:Outlookの添付ファイルを特定のフォルダーに自動保存する

    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

    注: 行を見つけてください sSaveFolder = "C:\ Users \ DT168 \ Documents \ outlook-attachments \"をクリックし、目的の宛先フォルダーのパスに置き換えます。

  3. VBA スクリプトを保存して閉じます。 アプリケーション向け Microsoft Visual Basic 窓。
  4. に行きます Mail 表示し、クリックします ホーム > キャンペーンのルール > ルールとアラートを管理する.
  5. オープニング ルールとアラート ダイアログボックスをクリックしてください 新しいルール 上のボタン 電子メールのルール タブには何も表示されないことに注意してください。
  6. ルールウィザード ダイアログボックスが表示されるので、選択してください 受け取ったメッセージにルールを適用する オプションをクリックし、 Next
  7. ルール ウィザード (どの条件を確認しますか?) ダイアログボックスで Next オプションを選択せず​​に ボタンをクリックします。そして、 有り ポップアップのボタン Microsoft Outlookの ダイアログボックス。
  8. 以下では ルールウィザード (メッセージをどうしますか?) ダイアログ ボックスで、次の手順を実行します。
    1. チェック スクリプトを実行する オプションを選択します。 ヒント: オプションが表示されない場合は、 Outlook で「スクリプトの実行」オプションを有効にする方法については、このチュートリアルを参照してください。.
    2. 青い下線付きの「スクリプト」テキストをクリックして、 スクリプトを選択 ダイアログボックス。ここで、で追加したスクリプトを選択します ステップ 2 をクリックして OK
    3. Next ボタンを押して続行します。
  9. ルールウィザード (例外はありますか?) ダイアログボックスをクリックしてください Next 直接ボタン。
  10. 最後に ルールウィザード ダイアログ ボックスでルールに名前を付けてください。 ステップ 1 ボックスで、必要に応じてオプションをチェックします ステップ 2 セクションを開き、 終了
  11. それを閉めて ルールとアラート ダイアログボックス。

結果

[受信トレイに既にあるメッセージに対してこのルールを今すぐ実行する] オプションを選択した場合、電子メール アカウントからのすべての添付ファイルがダウンロードされ、指定された宛先フォルダーに保存されます。さらに、[このルールをオンにする] オプションをオンにすると、受信メールのすべての添付ファイルが自動的にダウンロードされ、指定されたフォルダーに保存されます。


Kutools for Outlookを使用してOutlookの添付ファイルをフォルダーに自動的にダウンロードする

Outlook用Kutools コンピュータにインストールされている場合、 自動デタッチ この機能を使用すると、設定した条件に基づいてすべてまたは特定の Outlook 添付ファイルを自動的にダウンロードし、選択したフォルダーに送信することができます。さらに、この機能により、サブフォルダーを柔軟に作成できます。これらのサブフォルダーに名前を付けるための XNUMX つの代替方法が提供されています。次のような形式のいずれかを選択できます。 [メッセージフォルダ]-[メッセージ件名]、または、選択した形式にカスタム テキスト文字列を接尾辞として追加することを選択します。この機能により、添付ファイルの整理とアクセシビリティが大幅に向上します。

Outlook用Kutools: 100 以上の必須ツールで Outlook を強化します。 60 日間無料で試用できます。条件はありません。   続きを読みます...   今すぐダウンロード!

  1. クツール > 自動デタッチ をクリックして機能ダイアログを開きます。
  2. アタッチメントの自動取り外し ダイアログで、 受信したすべての添付ファイルを自動デタッチします オプションを選択し、次のように設定します。
    1. 参照ボタンをクリックします 自動的に切り離された添付ファイルを保存する宛先フォルダーを指定します。
    2. (オプション) 以下のスタイルで添付ファイルを切り離します 添付ファイルを保存するためのサブフォルダーを作成する場合のオプション。
      • 以下のスタイルでサブフォルダーを作成します: サブフォルダーに、次のような事前定義された形式のいずれかで名前を付けます。 [メッセージフォルダ]-[メッセージ件名].
      • 保存した添付ファイルの名前を以下のスタイルに変更します: 事前定義された形式のいずれかを使用してサブフォルダーに名前を付け、カスタム テキスト文字列を接尾辞として追加します。
    3. (オプション) 添付ファイルアイコンはまだメールに残っています 添付ファイルのある電子メールに視覚的なインジケーターを保持するオプション。
    4. [OK]をクリックします。

結果

今後は、電子メールを受信すると、すべての添付ファイルが指定されたフォルダーに自動的に保存されます。

ヒント: 特定のルールに基づいて添付ファイルの自動取り外しを設定する場合は、 ルールによる添付ファイルの自動デタッチ 内のオプション アタッチメントの自動取り外し ダイアログ。その後、 NEW ボタンをクリックして、フィルター条件と希望の保存設定を定義します。

注意:

  • にアクセスしたい 自動デタッチ 特徴? ダウンロード Outlook用Kutools 今! これを超えて、Kutools は 100 以上の他の機能を誇り、60 日間の無料トライアルを提供しています。 待ってはいけません、今日試してみてください!
  • Outlook で受信した複数またはすべての電子メールから既存の添付ファイルを切り離すかダウンロードしたい場合は、Outlook 用 Kutools を適用してください。 すべてデタッチ(添付ファイル) or すべて保存(添付ファイル) 特徴。

関連記事:


最高のオフィス生産性向上ツール

Outlook用Kutools - Outlook を強化する 100 以上の強力な機能

🤖 AIメールアシスタント: AI の魔法を備えたインスタント プロのメール - ワンクリックで天才的な返信、完璧な口調、多言語の習得。メールを簡単に変革しましょう! ...

📧 自動メール: 不在時 (POP および IMAP で利用可能)  /  メール送信のスケジュール設定  /  メール送信時のルールによる自動CC/BCC  /  自動転送 (高度なルール)   /  あいさつを自動追加   /  複数受信者の電子メールを個別のメッセージに自動的に分割する ...

📨 電子メール管理: メールを簡単に思い出す  /  件名などで詐欺メールをブロック  /  重複するメールを削除する  /  高度な検索  /  フォルダーを統合する ...

📁 アタッチメント プロバッチ保存  /  バッチデタッチ  /  バッチ圧縮  /  自動保存   /  自動デタッチ  /  自動圧縮 ...

🌟 インターフェースマジック: 😊もっと可愛くてクールな絵文字   /  タブ付きビューで Outlook の生産性を向上  /  Outlook を閉じる代わりに最小化する ...

???? ワンクリックの驚異: 受信した添付ファイルをすべてに返信する  /   フィッシングメール対策  /  🕘送信者のタイムゾーンを表示 ...

👩🏼‍🤝‍👩🏻 連絡先とカレンダー: 選択したメールから連絡先を一括追加  /  連絡先グループを個別のグループに分割する  /  誕生日のリマインダーを削除する ...

オーバー 100の特長 あなたの探索をお待ちしています! ここをクリックして詳細をご覧ください。

 

 

Comments (115)
Rated 4.5 out of 5 · 1 ratings
This comment was minimized by the moderator on the site
Thank you for this information
This comment was minimized by the moderator on the site
May i ask some question?

I usually received mail to many people and many kinds of files.
So i should distinguish each file.
But now, It can`t.

So Did you have any idea for this?
(like chacnged file name or and so on...)

Thank you for your help

BR
Hansu
This comment was minimized by the moderator on the site
Thank you for your great code
This comment was minimized by the moderator on the site
Hi,
I create Module in Microsoft VBA & save it
However when go to create Rules in Outlook, I can't see the select box of "Run a script"
What is the reason & how to fix it?
Thank you
This comment was minimized by the moderator on the site
Hi there,

In some versions of Outlook, especially in more recent updates, the "Run a Script" option might be disabled by default due to security concerns. To enable the "Run a Script" option in Outlook, you usually need to modify the registry settings. Here's a general guide on how to do it:

1. Close Outlook: Make sure Outlook is not running.
2. Open Registry Editor: Press Win + R, type regedit, and hit Enter.
3. Navigate to the Outlook Security Settings: Depending on your version of Outlook, you'll need to navigate to a specific path in the Registry Editor. For example, for Outlook 2016, 2019, and Microsoft 365, you might navigate to HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\Security.
4. Modify/Add the Registry Value:
4.1 Right-click in the right pane and choose New > DWORD (32-bit) Value.
4.2 Name the new value as EnableUnsafeClientMailRules.
4.3 Set its value to 1.
5. Close Registry Editor and restart your computer.
6. Open Outlook and check if the "Run a Script" option is available.
This comment was minimized by the moderator on the site
Ale kupa, oszuści. Maile zaczynają znikać. Nie mam moich wiadomości.
This comment was minimized by the moderator on the site
Hi, code works great however I am saving excel files and was wondering how I can modify the saved name. I recieve files like this "exa 2022-08.xlsx" how can I save the excel file as just "2022-08"?

this is my current code and my file saves however as just a file type not excel.

Public Sub PortlandDaily(MItem As Outlook.MailItem)
Dim oAttachment As Outlook.Attachment
Dim sSaveFolder As String
sSaveFolder = "T:\_Portland\Engineering Data\Daily Production Data\Test\"
For Each oAttachment In MItem.Attachments

Dim SplitName() As String
SplitName = Split(oAttachment.DisplayName, ".")

Dim RightName As String
RightName = Right(SplitName(0), 7)

Dim SaveName As String

SaveName = sSaveFolder & RightName

oAttachment.SaveAsFile sSaveFolder & oAttachment.DisplayName

Next
End Sub
Rated 4.5 out of 5
This comment was minimized by the moderator on the site
Hi there,

Please try the code below:
Public Sub PortlandDaily(MItem As Outlook.MailItem)
Dim oAttachment As Outlook.Attachment
Dim sSaveFolder As String
sSaveFolder = "T:\_Portland\Engineering Data\Daily Production Data\Test\"
For Each oAttachment In MItem.Attachments
  Dim SplitName() As String
  SplitName = Split(oAttachment.DisplayName, ".")
  Dim RightName As String
  RightName = Right(SplitName(0), 7) 'You can also declare the file name here, e.g., RightName = "2022-08"
  Dim SaveName As String
  SaveName = sSaveFolder & RightName & "." & SplitName(1)
  oAttachment.SaveAsFile SaveName
Next
End Sub


Amanda
This comment was minimized by the moderator on the site
Hi. is it possible to give the attachment file an entirely new name, using information form the mail (for example the date of delivery).
This comment was minimized by the moderator on the site
Hi,
How can I create a VBA to save attachment (Excel file) in my location drive when email received in my outlook folder and using the file name based on cell value...Many thanks

Regards,
Anthony On
This comment was minimized by the moderator on the site
Bonjour, j'ai réussi à rajouter "exécuter un script" dans les règles et faire fonctionner le script dans outlook. Les pièces jointes d'un mail bien précis s'enregistrent parfaitement dans le dossier demandé. Sauf que j'aimerais enregistrer uniquement les fichiers .txt, et non les .pdf qui s'incrémentent également. Aussi j'ai une autre requête s'il vous plaît, le script fonctionne très bien pour définir un dossier de destination, mais je souhaite définir d'autres règles qui me permettraient d'enregistrer les pièces jointes d'autres mails vers un autre dossier de destination. J'ai essayé de faire un 2e module VBA, cela ne fonctionne pas. J'ai généré un deuxième projet VBA mais Outlook n'en gère qu'un seul. Dans ce cas, comment remédier s'il vous plait ? Merci pour ce tuto très clair pour moi qui suis débutante.
This comment was minimized by the moderator on the site
Hi pearl,
Could you please send the code you generated so that we can fix it?
Amanda
This comment was minimized by the moderator on the site
Hi Can we  download the attachment contains specific letters using VBA code
This comment was minimized by the moderator on the site
Hi DAS,
When you said “the attachment contains specific letters”, did you mean you want to download the attachments from specific letters?
Amanda
This comment was minimized by the moderator on the site
Hi,
I executed the VBA + Rule option and it seemed to work perfectly. However, it recently stopped working with no errors. The rule is set to read the subject line, move to a certain folder if there is a certain subject, and then run the script. I know the trigger is working in the rule because the first action (move to folder) is working as it should.
Any idea why the rule trigger would work, but the documents are no longer being saved?
Things I have tried/checked:-The file path is correct-I added delays in various spots in the vba using application.wait-outlook has been shutdown and re-opened, and so has my laptop
(disclosure: I am a bit of a VBA newbie, but have beginner level coding knowledge)
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