View Single Post
  #1  
Old March 7th 06, 01:58 PM posted to microsoft.public.outlook.program_forms
Dominique Schroeder
external usenet poster
 
Posts: 1
Default Error creating an MAPI session

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


Ads
 

Mortgage Calculator - Gómez PEER - Mortgage Calculator - Mortgage Calculator - Mortgage Calculator