返回一个 字符串 ,指定指定搜索的范围。 此为只读属性。
语法
expression。 Scope
表达 一个代表 Search 对象的变量。
备注
搜索范围在初始化搜索时定义。 有关详细信息,请参阅 AdvancedSearch 方法。
示例
下面的 Microsoft Visual Basic for Applications (VBA) 示例创建 搜索 对象。 该用户的 收件箱被指定为搜索的范围。 搜索已完成,并显示搜索的结果除了新对象的 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 支持和反馈,获取有关如何接收支持和提供反馈的指南。