ในบางครั้งคุณอาจต้องการส่งออกโฟลเดอร์ Outlook ที่มีโฟลเดอร์ย่อยและรายการทั้งหมดไปยังโฟลเดอร์ Windows เป็นชุด บทความนี้จะสอนวิธีการดังกล่าวที่ใช้ Outlook VBA
เมื่อคุณต้องการส่งออกโฟลเดอร์ Outlook ไปยังไดรฟ์ภายในเครื่องที่มีรายการทั้งหมดในโครงสร้างโฟลเดอร์เดียวกันหากคุณเลือกบันทึกและส่งออกด้วยตนเองจะต้องใช้เวลามาก เหตุใดคุณจึงไม่หันไปใช้วิธีอื่นเช่นเครื่องมือส่งออกหรือรหัส VBA เราจะเปิดเผยรหัส VBA ดังกล่าวให้คุณที่นี่ มันจะช่วยให้คุณประสบความสำเร็จได้เหมือนสายลม

ส่งออกโฟลเดอร์ย่อยและรายการทั้งหมดในโฟลเดอร์ Outlook ไปยังโฟลเดอร์ Windows
- ขั้นแรก ให้เปิดโปรแกรม Outlook ของคุณก่อน
- จากนั้นในหน้าต่างหลักของ Outlook ให้กดแป้นพิมพ์ลัด“ Alt + F11”
- จากนั้นหน้าต่าง“ Microsoft Visual Basic for Applications” จะปรากฏขึ้น
- ถัดไปคุณต้องเปิดโมดูลเปล่าและคัดลอกรหัส 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 Crashes
คุณอาจเคยเจอปัญหา Outlook ขัดข้องบ่อยครั้ง ส่วนใหญ่แล้ว หลังจากรีสตาร์ท Outlook ก็จะกลับมาทำงานได้ตามปกติ อย่างไรก็ตาม ก็อาจมีกรณีที่ไฟล์ PST ของเราเสียหาย ในเวลานั้น คุณอาจพยายามอย่างเต็มที่เพื่อกู้คืนข้อมูลในไฟล์ PST เช่น การใช้เครื่องมือที่มีประสบการณ์อย่างเช่น DataNumen Outlook Repair. มันสามารถที่จะ แก้ไข Outlook ข้อผิดพลาดและดึงข้อมูลจากไฟล์ PST ที่ถูกบุกรุกโดยไม่ต้องเสียเหงื่อ
บทนำผู้เขียน:
Shirley Zhang เป็นผู้เชี่ยวชาญด้านการกู้คืนข้อมูลใน DataNumen, Inc. ซึ่งเป็นผู้นำระดับโลกด้านเทคโนโลยีการกู้คืนข้อมูล ได้แก่ SQL Server ซ่อมแซม และผลิตภัณฑ์ซอฟต์แวร์ซ่อมแซมแนวโน้ม ดูข้อมูลเพิ่มเติมได้ที่ wwwdatanumenด้วย.


