Unzulässiges Keyword
09.02.2007 11:49:33
Anthony
habe ein kleines Problem bei einem Code und finde einfach keinen Ausweg. Möchte diesen Code verwenden und der Debugger schreit immer das Me (bei der Listbox) eine unzulässige Verwendung des Schlüsselwortes ist. Kann mir jemand helfen.
Vielen Dank im voraus für eure Mühe...
Option Explicit
Sub ListBox_Fill_With_Outlook_Contacts()
Dim myOutlook As Object
Dim conId As Integer
Dim conFolder As Object
Dim conItem As Object
Dim Qe As Integer
Dim ErrMsg As String
Application.StatusBar = " . . . die Adressen werden aus Outlook eingelesen"
Set myOutlook = CreateObject("Outlook.Application")
Set conFolder = myOutlook.GetNamespace("MAPI").GetDefaultFolder(olFolderContacts)
Me.ListBox1.ColumnCount = 7
'Zuweisen der Spaltenbreite in Pt
'1 cm ~ 28,3 Pt
Me.ListBox1.ColumnWidths = "70; 70; 28; 70; 28; 70; 70"
For conId = 1 To conFolder.Items.Count
Set conItem = conFolder.Items(conId)
With conItem
Me.ListBox1.AddItem " "
On Error GoTo conError
Me.ListBox1.List(conId - 1, 0) = .FirstName & " " & .LastName
Application.StatusBar = "Datensatz " & conId & " von " & conFolder.Items.Count & " wird gelesen: " & .FirstName
If .BusinessAddressPostOfficeBox = "" Then
UserForm1.ListBox1.List(conId - 1, 1) = .BusinessAddressStreet
Else
UserForm1.ListBox1.List(conId - 1, 1) = .BusinessAddressPostOfficeBox
End If
Me.ListBox1.List(conId - 1, 2) = .BusinessAddressPostalCode
Me.ListBox1.List(conId - 1, 3) = .BusinessAddressCity
Me.ListBox1.List(conId - 1, 4) = .CustomerID
Me.ListBox1.List(conId - 1, 5) = .AssistantName
Me.ListBox1.List(conId - 1, 6) = .MiddleName
errorStepin:
End With
Next conId