Problem Checking the available stores in my Inbox

Jaread Real Estate 1 Reputation point
2021-02-27T21:39:28.567+00:00

I'm trying Check the available stores in my Inbox but stopped in "Next oStore" and I receive this error:

Run-time error -941162370 (c7e7007e) Automation Error.

Sub Test()
Dim myNameSpace As Outlook.NameSpace
Dim oStore As Outlook.Store
Set myNameSpace = Application.GetNamespace("MAPI")
For Each oStore In myNameSpace.Stores
Debug.Print oStore.DisplayName
Next oStore
End Sub
where is the problem... I have Stores in my Inbox. Someone can help me? Thanks

{count} votes