By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,964 Members | 1,810 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,964 IT Pros & Developers. It's quick & easy.

Error after 380 CreateObject("MAPI.Session")

P: n/a
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
Nov 13 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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

"Ottar" <la*****@earthling.net> wrote in message
news:43*************************@posting.google.co m...
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

Nov 13 '05 #2

P: n/a
No success unfornunatly, tried Dim MySession As Object same thing happens.

The code:
Dim MySession As MAPI.Session
Set MySession = CreateObject("MAPI.Session")

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

"Arvin Meyer" <a@m.com> wrote in message
news:#3**************@TK2MSFTNGP09.phx.gbl... 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

"Ottar" <la*****@earthling.net> wrote in message
news:43*************************@posting.google.co m...
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


Nov 13 '05 #3

P: n/a
No success unfornunatly, tried Dim MySession As Object; same thing happens.

The code:
Dim MySession As MAPI.Session
Set MySession = CreateObject("MAPI.Session")
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

"Arvin Meyer" <a@m.com> wrote in message news:<#3**************@TK2MSFTNGP09.phx.gbl>... 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

"Ottar" <la*****@earthling.net> wrote in message
news:43*************************@posting.google.co m...
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

Nov 13 '05 #4

P: n/a
"Ottar L. Osen" <la*************@earthling.net> wrote in message
news:O3**************@TK2MSFTNGP12.phx.gbl...
No success unfornunatly, tried Dim MySession As Object same thing happens.

The code:
Dim MySession As MAPI.Session
Set MySession = CreateObject("MAPI.Session")

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
Nov 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.