You can loop through the stores and get their names and by adding them to a collection you can loop through the names e.g. as follows. However due to the many ways that Outlook can be configured, you may get duplicates. If the following shows duplicates with the same message counts then you can remove the duplicates by using. As you may not know what you are dealing with it may be better to simply leave the duplicates and process the folder twice.
Code:
oColl.Add oStore, oStore
'in place of
oColl.Add oStore
to add to the collection
Code:
Sub Macro1()
Dim oStore As Store
Dim oFolder As Folder
Dim oColl As Collection
Dim i As Integer
Set oColl = New Collection
On Error Resume Next
For Each oStore In Session.Stores
Debug.Print oStore
oColl.Add oStore
Next oStore
On Error GoTo 0
For i = 1 To oColl.Count
Set oFolder = Session.Stores.Item(CStr(oColl(i))).GetDefaultFolder(olFolderInbox)
'do something with ofolder
Debug.Print oFolder.Items.Count
Next i
lbl_Exit:
Set oFolder = Nothing
Set oStore = Nothing
Set oColl = Nothing
Exit Sub
End Sub