Outlook (的 Search.Scope 屬性)
會傳回 String,此字串指定所指定搜尋的範圍。 唯讀。
語法
expression。 Scope
表達 代表 Search 物件的變數。
註解
當搜尋起始時,即已定義搜尋的範圍。 如需詳細資訊,請參閱 AdvancedSearch 方法。
範例
下列 Microsoft Visual Basic for Applications (VBA) 範例會建立 Search 物件。 使用者的 [收件匣 ] 會指定為搜尋範圍。 當搜尋完成並顯示新物件的 Tag 和 Scope 屬性以及搜尋結果時,就會發生此事件副程式。
Public blnSearchComp As Boolean
Private Sub Application_AdvancedSearchComplete(ByVal SearchObject As Search)
MsgBox "The AdvancedSearchComplete Event fired for " & SearchObject.Tag & " and the scope was " & SearchObject.Scope
blnSearchComp = True
End Sub
Sub TestAdvancedSearchComplete()
'List all items in the Inbox that do NOT have a flag.
Dim objSch As Outlook.Search
Const strF As String = "urn:schemas:httpmail:messageflag IS NULL"
Const strS As String = "Inbox"
Dim rsts As Outlook.Results
Dim i As Integer
blnSearchComp = False
Const strF1 As String = "urn:schemas:mailheader:subject = 'Test'"
Const strS1 As String = "Inbox"
Set objSch = _
Application.AdvancedSearch(Scope:=strS1, Filter:=strF1, Tag:="FlagSearch")
While blnSearchComp = False
DoEvents
Wend
Set rsts = objSch.Results
For i = 1 To rsts.Count
MsgBox rsts.Item(i).SenderName
Next
End Sub
另請參閱
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。