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

選択した複数の電子メールをMSGファイルとしてOutlookで一括保存するにはどうすればよいですか?

電子メールをMSGファイルとしてOutlookに保存するのは簡単です。 選択した複数の電子メールを個別のMSGファイルとしてOutlookにまとめて保存するにはどうすればよいですか? この記事では、それを実現する方法を紹介します。

選択した複数のメールをVBAコード付きのMSGファイルとして保存します


選択した複数のメールをVBAコード付きのMSGファイルとして保存します

次のVBAコードは、選択した複数の電子メールを個別のMSGファイルとしてOutlookにまとめて保存するのに役立ちます。 次のようにしてください。

1.MSGファイルとして保存する電子メールを選択します。 次に、Alt + F11キーを同時に押して、[Microsoft Visual Basic forApplications]ウィンドウを開きます。

2. [Microsoft Visual Basic for Applications]ウィンドウで、[挿入]> [モジュール]をクリックし、以下のVBAコードを[モジュール]ウィンドウにコピーします。

VBAコード:選択した複数の電子メールを個別のMSGファイルとしてOutlookに保存します

Public Sub SaveMessageAsMsg()
'Update by Extendoffice 2018/3/5
Dim xMail As Outlook.MailItem
Dim xObjItem As Object
Dim xPath As String
Dim xDtDate As Date
Dim xName, xFileName As String
On Error Resume Next
Set xShell = CreateObject("Shell.Application")
Set xFolder = xShell.BrowseForFolder(0, "Select a folder:", 0, strStartingFolder)
If Not TypeName(xFolder) = "Nothing" Then
    Set xFolderItem = xFolder.self
    xFileName = xFolderItem.Path & "\"
Else
    xFileName = ""
    Exit Sub
End If
For Each xObjItem In Outlook.ActiveExplorer.Selection
    If xObjItem.Class = olMail Then
        Set xMail = xObjItem
        xName = xMail.Subject
        xDtDate = xMail.ReceivedTime
        xName = Format(xDtDate, "yyyymmdd", vbUseSystemDayOfWeek, _
          vbUseSystem) & Format(xDtDate, "-hhnnss", _
          vbUseSystemDayOfWeek, vbUseSystem) & "-" & xName & ".msg"
        xPath = xFileName + xName
        xMail.SaveAs xPath, olMSG
    End If
Next
End Sub

3.F5キーを押してコードを実行します。

4. [フォルダーの参照] ダイアログ ボックスで、MSG ファイルを保存するフォルダーを指定し、[OK] ボタンをクリックします。 スクリーンショットを参照してください:

これで、以下のスクリーンショットに示すように、選択したすべてのメールが個別の MSG ファイルとして保存されます。


選択した電子メールを異なる形式のファイルとしてOutlookに簡単に保存できます。

一括保存 の有用性 Outlook用Kutools、以下のスクリーンショットに示すように、選択した複数の電子メールを個別のHTML形式ファイル、TXT形式ファイル、Word文書、CSVファイル、およびPDFファイルとしてOutlookに簡単に保存できます。 ダウンロードして今すぐ試してみてください! (60 日間の無料トレイル)


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

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

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

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

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

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

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

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

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

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

 

 

Comments (5)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
It doesn't seem to work when emails are displayed in conversation mode or from a Group folder.
This comment was minimized by the moderator on the site
Hi, i am new to macro. i am looking for a macro that allows me to save the filename, not by subject or time. But by the reference # found inside the email body. This macro works well when i save multiple emails into my folder. But as i want each email to be saved using the reference #, would you have a macro for it? The reference # is found on the 6th row of the emails body (REF : WL344ET2), that i received everyday. Appreciate if anyone can help on this and thank you in advance.
This comment was minimized by the moderator on the site
When there is a ":" in the subject, this code cannot copy the whole subject to be the name of the saved message, is there any way to solve this problem?
This comment was minimized by the moderator on the site
change line 21 to xName="". The saved message filname will not include the subject anymore.
This comment was minimized by the moderator on the site
A better way is to always replace ":" with blanks adding this line under xName = xMail.Subject

xName = Replace(xName, ":", "")
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations