Active X cannont create object

B

Ben Crinion

Hi

The following code works fine on several computers but is causing an "
ActiveX Component cannot create object " error on 1 machine.

'address dims
Dim objSession 'As MAPI.session
Dim session 'As session
Dim objAddressList 'As Redemption.AddressList
Dim objAddressEntries 'As Redemption.AddressEntries

'latch onto running session
'IT ERRORS HERE
Set objSession = CreateObject("MAPI.Session")
objSession.Logon ShowDialog:=False, NewSession:=False

'Get Global Address List
'Set objAddressList = outlook.Application.G(CdoAddressListGAL)
Set objAddressList = objSession.GetAddressList(CdoAddressListGAL)

The rest of the code in the function goes on to loop through the GAL
searching for contacts with a specified mobile phone number.

I cant understand why its not working, and so far i cant find anything on
the web to help.

Does anyone have a clue?

Thanks
Ben Crinion
 
B

Ben Crinion

Sorry i guess i didnt make it clear enough in the code snippet.

Set objSession = CreateObject("MAPI.Session")
 
S

Sue Mosher [MVP-Outlook]

Sorry, I should have been able to pick that out. The error means that CDO
1.21 is not installed on the machine. Rerun Outlook setup to install it.

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

Ben Crinion

Ok, the fix you provided worked.

Is there a way to distribute CDO or an equivalent with my application?

Or is there another way to get the address list like i do in the code
snipped below.

'Start session
Set objSession = CreateObject("MAPI.Session")
objSession.Logon ShowDialog:=False, NewSession:=False

'Get Global Address List
'Set objAddressList = outlook.Application.G(CdoAddressListGAL)
Set objAddressList = objSession.GetAddressList(CdoAddressListGAL)

The boss doesnt want me to use CDO as it means people who use our software
might have to reinstall their microsoft office to get it working and that
will put people off.
 
S

Sue Mosher [MVP-Outlook]

You cannot redistribute CDO, but you can invoke Windows Installer methods to
install it from the user's Office or Outlook CD. The Items Command Bar
sample COM add-in from http://www.microeye.com demonstrates this.

If your application supports only Outlook 2002/3, you could use the Safe
Address Book component but it, too, would require installation from the
user's copy of Office.

Alternatively, use Redemption (http://www.dimastr.com/redemption/), which
you can redistribute and which has the advantage of avoiding Outlook
security prompts.
--
Sue Mosher, Outlook MVP
Author of
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

Similar Threads


Top