Error creating an MAPI session

  • Thread starter Dominique Schroeder
  • Start date
D

Dominique Schroeder

Here is the code below; I have problems with some machines and not others,
see comments in the code

thanks,

Dominique

sub item_open()

dim oSession 'MAPI session

dim strRetCode 'code to capture CDO success login



'clear error buffer

err.clear

on error resume next


'Use createobject to logon the CDO

' Need to use CDO to access access rights to MAPI folders

set oSession = application.createobject("MAPI.Session")

----- this is where it fails on some machines. Those are Office 2000 or
Office 2003 some have SP3 installed, one has SR1 (XP and windows 2000)

----- The error I get is -2147221005 Internal Application error

if not err.number = 0 then

msgbox err.number & " " & err.description

end if

'clear error buffer

err.clear

on error resume next

'Logon using an existing MAPI session

strRetCode=oSession.Logon("", "", false, false,0)

'error detected?

if not err.number = 0 then

msgbox "Could not establish CDO session"

oSession.logoff

Item_open = false

set oSession = nothing

strRetCode=0

exit sub

end if


etc...

end sub
 
S

Sue Mosher [MVP-Outlook]

Have you checked to see if those machines (a) have CDO 1.21 installed and (b) are running an anti-virus program that includes a script blocker to prevent OUtlook or CDO automation?

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top