hab da nen problem beim auslesen von den outlook-kontakten um sie in ne exceltabelle zu speichern. wie komme ich an die kategorie in der sich eine person befindet?
wäre toll, wenn mir einer helfen könnte.
MfG
Istari
füge in ein Modul einer Arbeitsmappe folgenden Code:
Dann noch unter Extra-Verweise im VBA-Editor Outlook "aktivieren" und einfach mal laufen lassen.
Sub Kontakt()
Dim OL
Dim NS
Dim mymail
Dim myitems
Dim myitem
Dim stopp
Dim kategorie
Dim zähler
zähler = 0
stopp = 0
Set OL = CreateObject("Outlook.Application")
Set NS = OL.GetNameSpace("MAPI")
Set mymail = NS.GetDefaultFolder(10).items
kategorie = Application.InputBox("Bitte gewünschte Kategorie eingeben:", "Benutzer: " & Application.UserName, "KATEGORIE")
If kategorie = False Then
Exit Sub
End If
While stopp <> 1
Set myitems = mymail.Restrict("[Kategorien]=" & kategorie & "")
For Each myitem In myitems
With myitem
zähler = zähler + 1
.display
End With
Next
stopp = 1
Wend
MsgBox "Es wurden " & zähler & " Datensätze gefunden!", vbInformation, "Benutzer: " & Application.UserName
End Sub
da sprech ich das ja so an:
Dim objOutlook As Outlook.Application
Dim objAddressList As Outlook.AddressList
Dim objAddressEntry As Outlook.AddressEntry
Dim arrAdressen() As String
Dim intCounter As Integer
Set objOutlook = CreateObject("Outlook.Application")
Set objAddressList = objOutlook.Session.AddressLists("Kontakte")
Excel.Application.Worksheets("email").Cells(n, 2) = objAddressEntry.Name
Excel.Application.Worksheets("email").Cells(n, 3) = objAddressEntry.Address
wie komm ich dann z.b. an die kategorie oder andere werte? mit objAdressEntry.categorie (oder ähnliches) klappt das nit...
MfG
Istari
da sprech ich das ja so an:
Dim objOutlook As Outlook.Application
Dim objAddressList As Outlook.AddressList
Dim objAddressEntry As Outlook.AddressEntry
Dim arrAdressen() As String
Dim intCounter As Integer
Set objOutlook = CreateObject("Outlook.Application")
Set objAddressList = objOutlook.Session.AddressLists("Kontakte")
Excel.Application.Worksheets("email").Cells(n, 2) = objAddressEntry.Name
Excel.Application.Worksheets("email").Cells(n, 3) = objAddressEntry.Address
wie komm ich dann z.b. an die kategorie oder andere werte? mit objAdressEntry.categorie (oder ähnliches) klappt das nit...
MfG
Istari
Gruß
AJK