Error after 380 CreateObject("MAPI.Session")

  • Thread starter Thread starter Ottar
  • Start date Start date
O

Ottar

Error: 80040108 after 380 CreateObject("MAPI.Session")

Function MAPI_Test2()
Dim i As Integer
Dim MySession As MAPI.Session

i = 0
While (i < 2000)
Set MySession = CreateObject("MAPI.Session")
Debug.Print i
i = i + 1
Set MySession = Nothing
DoEvents
Wend
End Function

Any ideas?

Best regards
Ottar
 
You are Dim'ing MySeesion as MAPI.Session which you cannot do without
setting a reference. If you want to use early binding, set a reference. If
you want to use late binding, change your code to:

Dim MySession As Object

It should run fine, if you do that.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
No success unfornunatly, tried Dim MySession As Object same thing happens.

The code:
Is taken directly from Microsoft MSDN articles.

Any other suggestions? Could you try it on your PC? I've tried it on 3 PC's
with same result.

Best regards

Ottar
 
Ottar L. Osen said:
No success unfornunatly, tried Dim MySession As Object same thing happens.

The code:

Is taken directly from Microsoft MSDN articles.

Any other suggestions? Could you try it on your PC? I've tried it on 3 PC's
with same result.

I did try it on my PC, and it worked with the one change I showed.

I was able to generate 2000 counts in the debug window. Keep in mind that I
have a GB of memory, so I probably have enough to allocate to all those
instances of MAPI.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Back
Top