Outlook) (Application.AdvancedSearchStopped 事件

當指定 搜尋 物件的 Stop 方法已執行時發生。

語法

expression。 AdvancedSearchStopped( _SearchObject_ )

expression 代表 Application 物件的變數。

參數

名稱 必要/選用 資料類型 描述
SearchObject 必要 搜尋 AdvancedSearch 方法傳回的 Search 物件。

註解

引發此事件後, 搜尋 物件的 [結果 ] 集合將不再更新。 只能以程式觸發此事件。

範例

下列 Visual Basic for Applications (VBA) 範例會開始在 收件匣 中搜尋主旨等於 “Test” 的項目,然後立即停止搜尋。 這會導致 AdvanceSearchStopped 事件程序執行。 範例程式碼必須放在類別模組中,例如 ThisOutlookSession。 StopSearch()在 Microsoft Outlook 呼叫事件程序之前,必須先呼叫程序。

Sub StopSearch() 
 
 Dim sch As Outlook.Search 
 
 Dim strScope As String 
 
 Dim strFilter As String 
 
 strScope = "Inbox" 
 
 strFilter = "urn:schemas:httpmail:subject = 'Test'" 
 
 Set sch = Application.AdvancedSearch(strScope, strFilter) 
 
 sch.Stop 
 
End Sub 
 
 
 
Private Sub Application_AdvancedSearchStopped(ByVal SearchObject As Search) 
 
 'Inform the user that the search has stopped. 
 
 MsgBox "An AdvancedSearch has been interrupted and stopped. " 
 
End Sub

另請參閱

Application 物件

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。