Contacts

K

Kerry

Hi

Word XP & Outlook XP

I have created a user form which will allow me to pull
information from my outlook contacts. When I ran the
first test it worked wonderfully. When i ran the second
test it will not show the form - i get the error
"run time error 429 - Active X Component can't create
object"

I have a macro which display the userform, the userform
then has coding attached to the initialize event. Please
see my intialize code below - any ideas?? Thanks very much

Private Sub UserForm_Initialize()
Dim oApp As Outlook.Application
Dim oNspc As NameSpace
Dim oItm As ContactItem
Dim x As Integer
If Not DisplayStatusBar Then
DisplayStatusBar = True
End If
StatusBar = "Please Wait....."
x = 0
Set oApp = CreateObject(Outlook.Application)
Set oNspc = oApp.GetNamespace("MAPI")
For Each oItm In oNspc.GetDefaultFolder
(olFolderContacts).Items
With Me.cboContactList
.AddItem (oItm.FullName)
.Column(1, x) = oItm.BusinessAddress
.Column(2, x) = oItm.BusinessAddressCity
.Column(3, x) = oItm.BusinessAddressState
.Column(4, x) = oItm.BusinessAddressPostalCode
.Column(5, x) = oItm.Email1Address
End With
x = x + 1
Next oItm
StatusBar = ""
Set oItm = Nothing
Set oNspc = Nothing
Set oApp = Nothing
End Sub

I have tried to run it with outlook open and without but
no joy there either.
 
H

Harold

The name of the object needs to be surrounded by quotes
Set oApp = CreateObject("Outlook.Application")

Regards,
 

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

Combo Box 1
Combo Box 0
Outlook Connection 6
Outlook Connection 1
Word Connection 3
Adding Contact with VBA 4
Accessing Contact subfolders with a VBA macro 1
Working with non-default folders in VBA 2

Top