CDO Access Hangs Outlook

R

rg

Hello,

Two Outlook 2003 users at my company are having the same problem as the post
at the end of this post.

My code is similar (if not exactly the same--it is from a book example).

Set oCDOSession = application.CreateObject("MAPI.Session")

oCDOSession.Logon "", "", False, False, 0

http://support.microsoft.com/?kbid=177630 sounded like it might be the
problem, but

changing the Logon to

oCDOSession.Logon "", "", False, False, 0, True

did not fix the problem (although it still works on my computer).

I did check to make sure that the CDO component of Outlook 2003 was
installed (via the MS Office 2003 Install).

I have the appcompat.txt that MS created because of the error.

Any help is greatly appreciated. I haven't found any other possible
solutions by Googling yet.

Thank you,

Roy

Hoppers said:
I have been using the below code to access information via CDO. All
works fine on my outlook and many other users, however there are some
users that when they open my form their Outlook hangs.

A seperate Outlook process appears in task manager and it doesn't
matter how long i leave it the code never continues.
If the process is killed the CDO access returns a VBSript error.

"Error in lonon: - 2147024891
Collaberation Data Objects - E_Accessdenied(80070005)"

Can anyone help with any suggestions.

I'm not a developer and i'm quiet new to outlook coding so i would be
grateful for simplistic answers.

Thanks

Outlook version = 2002 sp2
Exchange 5.5

****************************************************************************
**
Function OpenMapiSession()
on error resume next
'Start the CDO code to find a match.
Set cdoSession = CreateObject("Mapi.session")
cdoSession.Logon ,,false,false,0 'Use the existing Outlook session.
if err.number <> 0 then msgbox "ERROR in logon: " & err.number &
vbCRLF & err.description
Set cdoAddrEntry = cdoSession.CurrentUser
if err.number <> 0 then msgbox "ERROR in logon: " & err.number &
vbCRLF & err.description
'Get data from Session.CurrentUser.
MapiSession = 1
PresentUser = cdoAddrEntry.fields(cdo_FirstName) & " " &
cdoAddrEntry.fields(cdo_Surname)
UserTelNumber = cdoAddrEntry.fields(cdoPR_Business_Telephone_Number)
RequestersDisplayName = cdoAddrEntry.fields(CdoPR_DISPLAY_NAME)
Item.UserProperties.find("ImplementerName").value = PresentUser
End Function
****************************************************************************
**
 
S

Sue Mosher [MVP-Outlook]

What's the context in which your code is running -- Outlook VBA, web page,
etc.?
 
R

rg

Thank you for the quick response, Sue.

The code is running behind a custom form in Outlook.

Roy
 
S

Sue Mosher [MVP-Outlook]

Have you checked to make sure that CDO is installed on the problem systems?

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
R

rg

I am testing on a different machine to try to determine why it works on some
machines and not on others.

One difference I am seeing is that on machines that the forms work on, you
will receive the Outlook object model guard security warning. The sequence
on machines that are OK is:

1) Select the command button on the custom form that triggers that CDO
session code.
2) The AddressBook dialog opens with the cdoSession.AddressBook call.
3) Select the recipient from the address book.
4) Select OK on the AddressBook dialog.
5) Outlook issues the object model guard security warning.
6) Select "Allow access..." and "Yes" ... and everything is OK.

On machines that the custom form is not working, the sequence is:

1) Select the command button on the custom form that triggers that CDO
session code.
2) The AddressBook dialog opens with the cdoSession.AddressBook call.
3) Select the recipient from the address book.
4) Select OK on the AddressBook dialog.
5) Outlook hangs and the process must be ended from Task Manager.

It looks as if the system is having problems generating that security
warning.

I hope this helps.

Roy
 
R

rg

Yes. On one of the systems the problem appeared after installing the CDO
component of Outlook 2003 (as part of the MS Office 2003 install). Before
the CDO component was installed, nothing happened when the user clicked the
button that created the CDO session.
 
S

Sue Mosher [MVP-Outlook]

I'd do a detect and repair, maybe even renaming cdo.dll first to make sure
it gets updated. You should be getting a security prompt with
Session.Addressbook on any machine with OUtlook 2000 SP2 or later.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
R

rg

Sue,

The user did a detect and repair both before and after renaming cdo.dll, and
they still have the problem.

I compared the version on my machine, that is working correctly, with their
version:

cdo.dll, ver. 6.5.6980.13, is on the working machine;
cdo.dll, ver. 6.5.6980.74, is on the machine that is not working;

In addition, we have different versions of cdosys.dll.

We also tried registering the cdo.dll using regsvr on his machine--but it
did not help.

Thanks again,

Roy
 

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