如何将Outlook文件夹结构复制到桌面(Windows资源管理器)?
众所周知,我们可以使用归档功能将文件夹结构复制到另一个Outlook中,但您是否知道如何将Outlook文件夹结构复制到某个特定的窗口文件夹,例如桌面?本文将介绍一种VBA方法,轻松将Outlook文件夹结构复制到Windows资源管理器。
将Outlook文件夹结构复制到桌面(Windows资源管理器)
将Outlook文件夹结构复制到桌面(Windows资源管理器)
请按照以下步骤将Outlook文件夹结构复制到桌面或Windows资源管理器。
1. 在导航窗格中,请点击以突出显示要复制其文件夹结构的指定文件夹,然后按“Alt”+“F11”键打开Microsoft Visual Basic for Applications窗口。

2. 点击“工具”>“引用”以打开“引用”对话框。然后在对话框中勾选“Microsoft Scripting Runtime”选项,并点击“确定”按钮。参见截图:

3. 点击“插入”>“模块”,并将以下VBA代码复制并粘贴到新模块窗口中。
VBA:将Outlook文件夹结构复制到Windows资源管理器
Dim xFSO As Scripting.FileSystemObject
Sub CopyOutlookFldStructureToWinExplorer()
ExportAction "Copy"
End Sub
Sub ExportAction(xAction As String)
Dim xFolder As Outlook.Folder
Dim xFldPath As String
xFldPath = SelectAFolder()
If xFldPath = "" Then
MsgBox "You did not select a folder. Export cancelled.", vbInformation + vbOKOnly, "Kutools for Outlook"
Else
Set xFSO = New Scripting.FileSystemObject
Set xFolder = Outlook.Application.ActiveExplorer.CurrentFolder
ExportOutlookFolder xFolder, xFldPath
End If
Set xFolder = Nothing
Set xFSO = Nothing
End Sub
Sub ExportOutlookFolder(ByVal OutlookFolder As Outlook.Folder, xFldPath As String)
Dim xSubFld As Outlook.Folder
Dim xItem As Object
Dim xPath As String
Dim xFilePath As String
Dim xSubject As String
Dim xCount As Integer
Dim xFilename As String
On Error Resume Next
xPath = xFldPath & "\" & OutlookFolder.Name
'?????????,??????
If Dir(xPath, 16) = Empty Then MkDir xPath
For Each xItem In OutlookFolder.Items
xSubject = ReplaceInvalidCharacters(xItem.Subject)
xFilename = xSubject & ".msg"
xCount = 0
xFilePath = xPath & "\" & xFilename
If xFSO.FileExists(xFilePath) Then
xCount = xCount + 1
xFilename = xSubject & " (" & xCount & ").msg"
xFilePath = xPath & "\" & xFilename
End If
xItem.SaveAs xFilePath, olMSG
Next
For Each xSubFld In OutlookFolder.Folders
ExportOutlookFolder xSubFld, xPath
Next
Set OutlookFolder = Nothing
Set xItem = Nothing
End Sub
Function SelectAFolder() As String
Dim xSelFolder As Object
Dim xShell As Object
On Error Resume Next
Set xShell = CreateObject("Shell.Application")
Set xSelFolder = xShell.BrowseForFolder(0, "Select a folder", 0, 0)
If Not TypeName(xSelFolder) = "Nothing" Then
SelectAFolder = xSelFolder.self.Path
End If
Set xSelFolder = Nothing
Set xShell = Nothing
End Function
Function ReplaceInvalidCharacters(Str As String) As String
Dim xRegEx
Set xRegEx = CreateObject("vbscript.regexp")
xRegEx.Global = True
xRegEx.IgnoreCase = False
xRegEx.Pattern = "\||\/|\<|\>|""|:|\*|\\|\?"
ReplaceInvalidCharacters = xRegEx.Replace(Str, "")
End Function
4. 按“F5”键或点击“运行”按钮来运行此VBA。
5. 在弹出的“浏览文件夹”对话框中,请选择要放置复制的文件夹结构的指定文件夹,并点击“确定”按钮。参见截图:

现在转到指定的文件夹,您将看到文件夹结构已复制到指定的硬盘中。参见截图:

注意:文件夹中的项目,例如邮件、约会、任务等,也会被复制到硬盘中的相应文件夹中。
相关文章
如何在Outlook中将文件夹结构复制到新的PST数据文件中?
最佳办公生产力工具
重磅消息:Kutools for Outlook 推出免费版本!
体验全新 Kutools for Outlook 免费版本,拥有 70 多项令人惊叹的功能,永久免费使用!立即点击下载!
🤖 Kutools AI :利用先进的人工智能技术轻松处理电子邮件,包括回复、总结、优化、扩展、翻译和撰写邮件。
📧 邮件自动化:自动答复(支持 POP 和 IMAP) / 定时发送邮件 / 按规则自动抄送密送 / 自动转发(高级规则) / 自动添加问候语 / 自动将多收件人邮件拆分为单独消息 ...
📨 邮件管理:撤回邮件 / 按主题和其他条件阻止垃圾邮件 / 删除重复邮件 / 高级搜索 / 整合文件夹 ...
📁 附件增强功能:批量保存 / 批量拆离 / 批量压缩 / 自动保存 / 自动拆离 / 自动压缩 ...
🌟 界面魔法:😊更多漂亮酷炫的表情符号 / 当重要邮件到达时提醒您 / 最小化 Outlook 而不是关闭 ...
👍 一键奇效:带附件回复所有人 / 反钓鱼邮件 / 🕘显示发件人的时区 ...
👩🏼🤝👩🏻 联系人和日历:从选定的邮件中批量添加联系人 / 将联系人组拆分为单独的组 / 移除生日提醒 ...
单击即可立即解锁 Kutools for Outlook。不要再等待,现在就下载并提升您的效率!

