view raw
Markowitz Markowitz - 1 year ago 83 Question

Loop for all outlook inspectors

Lets say I have opened 3 outlook inspector.

How to loop for 3 outlook inspector?

So, I need a code like following;

For Each i In All.Outlook.Inspectors

Next i


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  
  MsgBox "No inspector windows are open."  
End If 

You may find the Getting Started with VBA in Outlook 2010 article helpful.