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.
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.