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

su_80 1 Reputation point
2021-01-05T11:49:56.397+00:00

Hello, Triying to use a macro in a shared store in Outlook, I received this error:

"Run-time error '-1698234242 (9ac7007e)' Automation Error.

Then I did a "test" for Check the available stores in my Inbox but stopped in "Next oStore" and I receive this error (similar to the previous):

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. The error is not in the code. Someone for helping me? Thanks in advance.

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,938 questions
Outlook Management
Outlook Management
Outlook: A family of Microsoft email and calendar products.Management: The act or process of organizing, handling, directing or controlling something.
5,248 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Tom van Stiphout 1,696 Reputation points MVP
    2021-01-09T20:47:54.227+00:00

    The help page on Store object says you should check using IsOpen before accessing a store. Try that.

    Your simple code works just fine for me.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.