如何在组电子邮件帐户中运行Outlook宏?我有一个宏,可以在个人电子邮件框中正常工作。
但是我需要在企业电子邮件帐户中运行它。 这是我的代码。
Sub CreateSearchFolder_AllNotRepliedEmails()
Dim strScope As String
Dim strRepliedProperty As String
Dim strFilter As String
Dim objSearch As Outlook.Search
Dim ns As NameSpace
'Specify the folders to be searched
'Here we use Inbox folder for an example
strScope = "'" & Application.Session.GetNamespace("MAPI")(olFolderInbox).FolderPath & "'"
'Search filter
strRepliedProperty = "http://schemas.microsoft.com/mapi/proptag/0x10810003"
strFilter = Chr(34) & strRepliedProperty & Chr(34) & " <> 102" & "AND" & Chr(34) & strRepliedProperty & Chr(34) & " <> 103"
Set objSearch = Outlook.Application.AdvancedSearch(Scope:=strScope, Filter:=strFilter, SearchSubFolders:=True, Tag:="SearchFolder")
'Save the search folder
objSearch.Save ("Not Replied Emails")
MsgBox "Search folder is created successfully!", vbInformation + vbOKOnly, "Search Folder"
End Sub