Class Inspectors (Outlook VBA)
Contains a set of Inspector objects representing all inspectors. To use a Inspectors class variable it first needs to be instantiated, for example
Dim ins as Inspectors
Set ins = Inspectors
For Each
Here is an example of processing the Inspectors items in a collection.
Dim ins As Inspector
For Each ins In Inspectors
Next ins
Add
Creates a new inspector window.
This method is essentially identical to the GetInspector property of an Outlook item, such as MailItem.
Add (Item)
Item: The item to display in the inspector window when it is created.
Sub DisplayMyContacts()
Dim myFolder As Folder
Dim myItems As Items
Dim myRestrictItems As Items
Dim answer As String
Dim filter As String
Dim myInspector As Inspector
Dim x As Integer
answer = InputBox("Enter the company name")
Set myFolder = Application.GetNamespace("MAPI") _
.GetDefaultFolder(olFolderContacts)
filter = "[MessageClass] = 'IPM.Contact' AND [CompanyName] = '" & answer & "'"
Set myItems = myFolder.Items
Set myRestrictItems = myItems.Restrict(filter)
For x = 1 To myRestrictItems.Count
Set myInspector = Application.Inspectors.Add(myRestrictItems.Item(x))
myInspector.Display
Next x
End Sub
Class
Returns an OlObjectClass constant indicating the object's class. Here you can find possible values for
Dim oocsClass As OlObjectClass
oocsClass = Inspectors.Class
Count
Returns a Long indicating the count of objects in the specified collection.
Dim lngCount As Long
lngCount = Inspectors.Count
Item
Returns an Inspector object from the collection.
Item (Index)
Index: Either the index number of the object, or a value used to match the default property of an object in the collection.
Dim ins As Inspector
Set ins = Inspectors(Index:=1)
Session
Returns the NameSpace object for the current session.
The Session property and the GetNamespace method can be used interchangeably to obtain the NameSpace object for the current session. Both members serve the same purpose. For example, the following statements do the same function: