Mit folgenden (kopierten) Zeilen möchte ich Adressen aus Outlook einlesen.
Sub Kontakte()
Dim olAppl As Outlook.Application
Dim olNS As Outlook.Namespace
Dim olMAPIFolder As Outlook.MAPIFolder
Dim olItems As Outlook.Items
Dim olResItems As Outlook.Items
Dim olContact As Outlook.ContactItem
Dim intCounter As Integer
Dim sFilter As String
On Error GoTo byebye
Set olAppl = CreateObject("Outlook.Application")
Set olNS = olAppl.GetNamespace("MAPI")
Set olMAPIFolder = olNS.GetDefaultFolder(olFolderContacts)
Set olItems = olMAPIFolder.Items
sFilter = "[MessageClass] = 'IPM.Contact'"
Set olResItems = olItems.Restrict(sFilter)
Dim a As Variant
Set a = olContact
For Each olContact In olResItems
intCounter = intCounter + 1
Cells(intCounter, 3) = olContact.Birthday
Cells(intCounter, 4) = olContact.FirstName
Cells(intCounter, 5) = olContact.LastName
Cells(intCounter, 6) = olContact.Email1Address
Next olContact
byebye:
Set olResItems = Nothing
Set olItems = Nothing
Set olMAPIFolder = Nothing
Set olNS = Nothing
Set olAppl = Nothing
Exit Sub
End Sub
Weiß Jemand aus welcher Datei diese eingelesen werden? Jedenfalls nicht aus den aktuellen Kontakten.Vielen Dank für eine Antwort im Vorraus.
MfG
Ludwig