如何将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数据文件中?
最佳 Office 办公效率工具
重磅消息:Kutools for Outlook 推出免费版本!
体验全新 Kutools for Outlook 免费版,70 多个强大功能,永久免费使用!点击立即下载!
🤖 Kutools AI :利用先进的AI技术轻松处理邮件,包括答复、总结、优化、扩展、翻译和撰写邮件。
📧 邮件自动化:自动答复(支持POP和IMAP) /计划发送邮件 /发送邮件时根据规则自动抄送密送 / 自动转发(高级规则) / 自动添加问候语 / 自动将群发邮件拆分为单独邮件 ...
📨 邮件管理:撤回邮件 / 按主题等方式阻止诈骗邮件 / 删除重复邮件 / 高级搜索 / 整合文件夹 ...
📁 附件专家:批量保存 / 批量拆离 / 批量压缩 / 自动保存 / 自动拆离 / 自动压缩 ...
🌟 界面魔法:😊更多精美个性表情 /重要邮件来临时提醒您 / 最小化而非关闭 Outlook ...
👍 一键高效操作:带附件全部答复 /反钓鱼邮件 / 🕘显示发件人时区 ...
👩🏼🤝👩🏻 联系人与日历:从选中的邮件批量添加联系人 / 将联系人组拆分为多个独立组 / 移除生日提醒 ...
使用 Kutools,支持英语、西班牙语、德语、法语、中文及40 多种其他语言,满足您的语言偏好!
一键解锁 Kutools for Outlook。无需等待,立即下载,提升办公效率!

