K
Kerry
Hi
I have created a user form which displays a list of my
outlook contacts. These contact details are then used
for addressing letters, labels, memos etc. this works
wonderfully unless I have distribution lists in my
outlook contacts area - it will then show "Runtime error
13 - type mismatch"
Please, how can I get my contact drop down list in my
user form to not display distribution lists and not crash
either.
Thanks very much.
Kerry
Public Sub UserForm_Initialize()
' Dim oApp As Outlook.Application
' Dim oNspc As NameSpace
' Dim oItm As ContactItem
' Dim x As Integer
' Dim y As Integer
Dim myLocation
If Not Application.DisplayStatusBar Then
Application.DisplayStatusBar = True
End If
StatusBar = "Please Wait....."
recipient:
x = 0
Set oApp = CreateObject("Outlook.Application")
Set oNspc = oApp.GetNamespace("MAPI")
For Each oItm In oNspc.GetDefaultFolder
(olFolderContacts).Items
With Me.RecipList
.AddItem (oItm.FullName)
.Column(1, x) = oItm.JobTitle
.Column(2, x) = oItm.CompanyName
.Column(3, x) = oItm.BusinessAddress
.Column(4, x) = oItm.BusinessTelephoneNumber
.Column(5, x) = oItm.BusinessFaxNumber
End With
x = x + 1
Next oItm
StatusBar = "Ready..."
Set oItm = Nothing
Set oNspc = Nothing
Set oApp = Nothing
myLocation = System.ProfileString("ML", "Location")
Select Case myLocation
Case "birmingham"
BirmOpt = True
Case "london"
LonOpt = True
Case "wokingham"
WokOpt = True
End Select
Sender1.Caption = System.ProfileString("ML", "Sender1")
Sender2.Caption = System.ProfileString("ML", "Sender2")
Sender3.Caption = System.ProfileString("ML", "Sender3")
Sender4.Caption = System.ProfileString("ML", "Sender4")
End Sub
I have created a user form which displays a list of my
outlook contacts. These contact details are then used
for addressing letters, labels, memos etc. this works
wonderfully unless I have distribution lists in my
outlook contacts area - it will then show "Runtime error
13 - type mismatch"
Please, how can I get my contact drop down list in my
user form to not display distribution lists and not crash
either.
Thanks very much.
Kerry
Public Sub UserForm_Initialize()
' Dim oApp As Outlook.Application
' Dim oNspc As NameSpace
' Dim oItm As ContactItem
' Dim x As Integer
' Dim y As Integer
Dim myLocation
If Not Application.DisplayStatusBar Then
Application.DisplayStatusBar = True
End If
StatusBar = "Please Wait....."
recipient:
x = 0
Set oApp = CreateObject("Outlook.Application")
Set oNspc = oApp.GetNamespace("MAPI")
For Each oItm In oNspc.GetDefaultFolder
(olFolderContacts).Items
With Me.RecipList
.AddItem (oItm.FullName)
.Column(1, x) = oItm.JobTitle
.Column(2, x) = oItm.CompanyName
.Column(3, x) = oItm.BusinessAddress
.Column(4, x) = oItm.BusinessTelephoneNumber
.Column(5, x) = oItm.BusinessFaxNumber
End With
x = x + 1
Next oItm
StatusBar = "Ready..."
Set oItm = Nothing
Set oNspc = Nothing
Set oApp = Nothing
myLocation = System.ProfileString("ML", "Location")
Select Case myLocation
Case "birmingham"
BirmOpt = True
Case "london"
LonOpt = True
Case "wokingham"
WokOpt = True
End Select
Sender1.Caption = System.ProfileString("ML", "Sender1")
Sender2.Caption = System.ProfileString("ML", "Sender2")
Sender3.Caption = System.ProfileString("ML", "Sender3")
Sender4.Caption = System.ProfileString("ML", "Sender4")
End Sub