Reputation:
Lets say I have opened 3 outlook inspector.
How to loop for 3 outlook inspector?
So, I need a vb.net code like following;
For Each i In All.Outlook.Inspectors
Next i
Upvotes: 1
Views: 485
Reputation: 49395
The following code uses the Inspectors property and the Count property and Item method of the Inspectors object to display the captions of all inspector windows.
Dim myInspectors As Outlook.Inspectors
Dim x as Integer
Dim iCount As Integer
Set myInspectors = Application.Inspectors
iCount = Application.Inspectors.Count
If iCount > 0 Then
For x = 1 To iCount
MsgBox myInspectors.Item(x).Caption
Next x
Else
MsgBox "No inspector windows are open."
End If
You may find the Getting Started with VBA in Outlook 2010 article helpful.
Upvotes: 1