dudelidude
Goto Top

Makro welches das Suchfenster der Outlookadressen öffnet und Adressinformationen ausgibt.

Hallo liebes Leute und Programmierer

Ich habe ein Makro, dass das Outlookadresssuchfenster öffnet und bestimmte Kontaktdetails ausgibt. Wenn ich den Code richtig verstehe, dann liest er die Informationen aus, die in Zeile 12 und 13 aufgelistet sind. So z.B. mobil ist an 3ter Stelle und deshalb ist in Zeile 21 iRow + 3.Nicht wahr?Nun möchte ich weitere Informationen dazufügen z.b. plz. ,straße, stadt, Unternehmen (möglichst alle Informationen,die in Outlook hinterlegt sind. Dazu brauch ich quasi die richtigen Vokabeln denke ich, denn "co" steht scheinbar für country.Wenn ich nun aber "country" anstatt "co" in den Quellcode eingebe funktionert das Makro nicht mehr.Deshalb denke ich,dass wenn die Begriffe nicht stimmen,dass das Makro mir eine Fehlermeldung gibt. Kennt jemand die richtigen "Vokabeln"?Und ist mein Verstädnis für den Code überhaupt richtig? Oder hat jemand eine Lösung für das Problem?Über Hilfe bin ich sehr Dankbar.Dann noch einen schönen Abend.

1- Dim GC As Object, Child As Object, rootDomaine As Object, objConnection As Object
2 -Dim objCommand As Object, objRecordSet
3 - Set GC = GetObject("GC:")
4 - For Each Child In GC
5 - Set rootDomain = Child
6 - Next
7 - Set objConnection = CreateObject("ADODB.Connection")
8 - Set objCommand = CreateObject("ADODB.Command")
9 - objConnection.Provider = "ADsDSOObject"
10- objConnection.Open "Active Directory Provider"
11- Set objCommand.ActiveConnection = objConnection
12- objCommand.CommandText = "<GC://" & rootDomain.Name & ">;(samAccountName=" & Name 13& ");displayName,telephoneNumber,mobile,mail,sn,givenName,department,physicalDeliveryOfficeName,co;subTree"
14- Set objRecordSet = objCommand.Execute

15 - If Not objRecordSet.EOF Then
16 - Cells(iRow, iCol).Value = objRecordSet.Fields("sn").Value
17 - Cells(iRow + 1, iCol).Value = objRecordSet.Fields("givenName").Value
18 - Cells(iRow + 4, iCol) = objRecordSet.Fields("mail").Value
19 - Cells(iRow + 5, iCol).Value = objRecordSet.Fields("department").Value
20 - Cells(iRow + 2, iCol).Value = objRecordSet.Fields("telephoneNumber").Value
21 - Cells(iRow + 3, iCol).Value = objRecordSet.Fields("mobile").Value
22 - 'Cells(iRow + 8, iCol).Value = objRecordSet.Fields("city").Value
23 - 'Cells(iRow, iCol).Value = objRecordSet.Fields("displayName").Value
24 - Cells(iRow + 6, iCol).Value = objRecordSet.Fields("physicalDeliveryOfficeName").Value
25 - Cells(iRow + 7, iCol).Value = objRecordSet.Fields("co").Value
26 - Cells(iRow - 1, iCol).Select
End If
End Sub

Content-Key: 169771

Url: https://administrator.de/contentid/169771

Ausgedruckt am: 29.03.2024 um 02:03 Uhr