ist es möglich aus einer Excel Tabelle aus unterschiedlichen Zellen verschiedene Kontakte in Outlook aufzurufen?
MfG
Dierk
Sub ListBoxAusOutlook()
' Achtung: Der Verweis (Extras/Verweise unter VBA) auf die
' "Microsoft Outlook 9.0 Object Library" muss aktiviert sein !!!
Dim Verz As Object
Dim iIndx As Integer
Dim olMAPI As New Outlook.Application
Dim objItem As Object
Application.DisplayAlerts = False
Application.StatusBar = " die Adressen werden aus Outlook geholt " _
& " - das kann einen Moment dauern."
Set Verz = olMAPI.GetNamespace("MAPI").GetDefaultFolder(olFolderContacts)
UserForm1.ListBox1.ColumnCount = 7
UserForm1.ListBox1.ColumnWidths = _
"7,0 cm; 3,5 cm; 1,0 cm; 3,0 cm; 1,0 cm; 3,5 cm; 3,0 cm"
For iIndx = 1 To Verz.Items.Count
Set objItem = Verz.Items(iIndx)
With objItem
UserForm1.ListBox1.AddItem " "
UserForm1.ListBox1.List(iIndx - 1, 0) = .FirstName _
& " " & .LastName
If .BusinessAddressPostOfficeBox = "" Then
UserForm1.ListBox1.List(iIndx - 1, 1) = .BusinessAddressStreet
Else
UserForm1.ListBox1.List(iIndx - 1, 1) = .BusinessAddressPostOfficeBox
End If
UserForm1.ListBox1.List(iIndx - 1, 2) = .BusinessAddressPostalCode
UserForm1.ListBox1.List(iIndx - 1, 3) = .BusinessAddressCity
UserForm1.ListBox1.List(iIndx - 1, 4) = .CustomerID
UserForm1.ListBox1.List(iIndx - 1, 5) = .AssistantName
UserForm1.ListBox1.List(iIndx - 1, 6) = .MiddleName
End With
Next iIndx
Set objItem = Nothing
Set olMAPI = Nothing
' die ListBox nach Namen (nach nur einer, der ersten Spalte) sortieren
listbox_quick_sort 0, 6, UserForm1.ListBox1, 0, UserForm1.ListBox1.ListCount - 1
Application.DisplayAlerts = True
Application.StatusBar = False
End Sub