場合によっては、すべてのサブフォルダーとアイテムを含むOutlookフォルダーをWindowsフォルダーにバッチエクスポートすることができます。 この記事では、OutlookVBAを適用するそのような方法について説明します。
Outlookフォルダーを、すべてのアイテムが同じフォルダー構造内にあるローカルドライブにエクスポートする場合、手動で保存およびエクスポートすることを選択すると、時間がかかります。 したがって、エクスポートツールやVBAコードなど、他の手段に頼ってみませんか? ここでは、そのようなVBAコードを公開します。 それはあなたがそよ風のようにそれを達成することを可能にするでしょう。
Outlookフォルダー内のすべてのサブフォルダーとアイテムをWindowsフォルダーにエクスポートする
- まず最初に、Outlookプログラムを起動してください。
- 次に、Outlookのメインウィンドウで、「Alt + F11」キーのショートカットを押します。
- 続いて、「Microsoft Visual BasicforApplications」ウィンドウがポップアップ表示されます。
- 次に、空のモジュールを開いて、次のVBAコードをそのモジュールにコピーする必要があります。
Private objFileSystem As Object
Private Sub ExportFolderWithAllItems()
Dim objFolder As Outlook.Folder
Dim strPath As String
'Specify the root local folder
'Change it as per your needs
strPath = "E:\Outlook\"
Set objFileSystem = CreateObject("Scripting.FileSystemObject")
'Select a Outlook PST file or Outlook folder
Set objFolder = Outlook.Application.Session.PickFolder
Call ProcessFolders(objFolder, strPath)
MsgBox "Complete", vbExclamation
End Sub
Private Sub ProcessFolders(objCurrentFolder As Outlook.Folder, strCurrentPath As String)
Dim objItem As Object
Dim strSubject, strFileName, strFilePath As String
Dim objSubfolder As Outlook.Folder
'Create the local folder based on the Outlook folder
strCurrentPath = strCurrentPath & objCurrentFolder.Name
objFileSystem.CreateFolder strCurrentPath
For Each objItem In objCurrentFolder.Items
strSubject = objItem.Subject
'Remove unsupported characters in the subject
strSubject = Replace(strSubject, "/", " ")
strSubject = Replace(strSubject, "\", " ")
strSubject = Replace(strSubject, ":", "")
strSubject = Replace(strSubject, "?", " ")
strSubject = Replace(strSubject, Chr(34), " ")
strFileName = strSubject & ".msg"
i = 0
Do Until False
strFilePath = strCurrentPath & "\" & strFileName
'Check if there exist a file in the same name
If objFileSystem.FileExists(strFilePath) Then
'Add a sequence order to the file name
i = i + 1
strFileName = strSubject & " (" & i & ").msg"
Else
Exit Do
End If
Loop
'Save as MSG file
objItem.SaveAs strFilePath, olMSG
Next
'Process subfolders recursively
If objCurrentFolder.folders.Count > 0 Then
For Each objSubfolder In objCurrentFolder.folders
Call ProcessFolders(objSubfolder, strCurrentPath & "\")
Next
End If
End Sub
- その後、Outlookがマクロ設定でマクロを許可していることを確認する必要があります。
- 最終的には、試してみることができます。
- まず、新しいマクロウィンドウに戻ります。
- 次に、「ExportFolderWithAllItems」サブルーチンをクリックします。
- 次に、F5キーボタンを押してこのマクロを実行します。
- その後、特定のフォルダを選択する必要があります。
- 最後に、「完了」というメッセージが表示されたら、事前定義されたローカルフォルダにアクセスできます。 すべてのアイテムが同じフォルダ構造に保存されていることがわかります。
Outlookのクラッシュによるデータ損失を防ぐ
Outlookがクラッシュするのを何度も経験したことがあるかもしれません。ほとんどの場合、再起動すればOutlookは正常に動作するようになります。しかし、PSTファイルが破損するケースもあります。その場合、経験豊富なツールに頼るなどしてPSTデータを復元しようとします。 DataNumen Outlook Repair。 できます Outlookを修正する エラーが発生し、汗をかくことなく、侵害されたPSTファイルからデータを抽出します。
著者紹介:
Shirley Zhangは、のデータ復旧の専門家です。 DataNumen、Inc。は、以下を含むデータ復旧技術の世界的リーダーです。 SQL Server 修理 と見通し修理ソフトウェア製品。 詳細については、次のWebサイトをご覧ください。 WWW。datanumen.com



