【发布时间】:2019-01-31 04:58:21
【问题描述】:
我正在尝试从 Excel 中的 VBA 宏打开 Outlook。我能够打开它,但如何使它进入特定文件夹?比如说“已发送邮件”、“草稿文件夹”等。另外,在另一个邮箱中选择一个文件夹怎么样?我的 Outlook 中有两个邮箱。
这是我目前的代码:
Sub my_prov_openOutlook()
Dim oOutlook As Object
On Error Resume Next
Set oOutlook = GetObject(, "Outlook.Application")
On Error GoTo 0
If oOutlook Is Nothing Then
Shell ("OUTLOOK")
'''I would like to open a specific folder under the inbox or under a subfolder
Else
oOutlook.ActiveWindow.Activate
'''I would like to open a specific folder under the inbox or under a subfolder
End If
【问题讨论】:
-
请使用
Try/Catch声明而不是On Error GoTo -
@Simo 这是 vba,不是 vb.net。