Problem Checking the available stores in my Inbox (Outlook VBA) RRS feed

  • Question

  • Hello, 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

    I don't know where is the problem... I already have Stores in my Inbox. Someone for helping me? Thanks in advance.
    Thursday, January 7, 2021 8:51 AM