SearchScope object (Office)
Corresponds to a type of folder tree that can be searched.
Remarks
Each SearchScope object contains a single ScopeFolder object that corresponds to the root folder of the search scope.
Use the Item property of the SearchScopes collection to return a SearchScope object; for example:
Dim ss As SearchScope
Set ss = SearchScopes.Item(1)
Ultimately, the SearchScope object is intended to provide access to ScopeFolder objects that can be added to the SearchFolders collection. For an example that demonstrates how this is accomplished, see the SearchFolders collection topic.
See the ScopeFolder object topic to see a simple example of how to return a ScopeFolder object from a SearchScope object.
Example
The following example displays all of the currently available SearchScope objects.
Sub DisplayAvailableScopes()
'Declare a variable that references a
'SearchScope object.
Dim ss As SearchScope
'Loop through the SearchScopes collection.
For Each ss In SearchScopes
Select Case ss.Type
Case msoSearchInMyComputer
MsgBox "My Computer is an available search scope."
Case msoSearchInMyNetworkPlaces
MsgBox "My Network Places is an available search scope."
Case msoSearchInOutlook
MsgBox "Outlook is an available search scope."
Case msoSearchInCustom
MsgBox "A custom search scope is available."
Case Else
MsgBox "Can't determine search scope."
End Select
Next ss
End Sub
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for