Thema Datum  Von Nutzer Rating
Antwort
13.04.2023 14:42:57 Blechinger
NotSolved
13.04.2023 16:09:19 Ulrich
NotSolved
14.04.2023 12:29:04 Blechinger
NotSolved
14.04.2023 12:40:58 Gast3239
NotSolved
Rot Access vba Daten aus Outlook Gal
14.04.2023 13:26:21 Blechinger
NotSolved
15.04.2023 11:18:05 Ulrich
NotSolved
15.04.2023 22:28:26 blechinger
NotSolved
16.04.2023 15:31:54 ralf_b
NotSolved
17.04.2023 08:18:19 Blechinger
NotSolved
17.04.2023 19:52:04 ralf_b
*****
Solved
18.04.2023 09:20:15 Blechinger
NotSolved
18.04.2023 13:42:02 Blechinger
NotSolved
18.04.2023 21:17:30 Blechinger
NotSolved

Ansicht des Beitrags:
Von:
Blechinger
Datum:
14.04.2023 13:26:21
Views:
320
Rating: Antwort:
  Ja
Thema:
Access vba Daten aus Outlook Gal

Ok. Das war nicht so klug von mir. Hier mein Code.

Private Sub Befehl2_Click()
RefreshGAL
End Sub

Sub RefreshGAL()
   
    If MsgBox("Sure you want to refresh table: tbl_GAL?", vbYesNo, "Attention") = vbYes Then
        MsgBox "Mind the Progressbar below - Press Okay", vbOKOnly, "GAL Refreshing started"
       
        Dim appOL As Object
        Dim oApp As Object
        Dim oGAL As Object
        Dim oContact As Object
        Dim oUser As Object
        Dim arrUsers(1 To 65000, 1 To 11) As String
        Dim UserIndex As Long
        Dim i As Long
        Dim rs As DAO.Recordset
        Dim DB As DAO.Database
        Set DB = CurrentDb()
       
        On Error Resume Next  ' Ignore Errors
        Set oApp = GetObject(, "Outlook.Application") 'Wants to provoke an Error if Outlook is started
        If Err.Number = 0 Then 'Tests if Outlook is started
           MsgBox ("Please close Outlook!")
        Else 'Starts the Import if Outlook is closed
       
          
       
            Set appOL = CreateObject("Outlook.Application")
            Set oGAL = appOL.GetNamespace("MAPI").AddressLists("Globale Adressliste").AddressEntries
           
            SysCmd acSysCmdInitMeter, "GAL Refreshing: ", oGAL.Count
           
            Set rs = DB.OpenRecordset("tbl_GAL", dbOpenDynaset, dbSeeChanges)
            For i = 1 To oGAL.Count ' Fügt alle Einträge ein
                SysCmd acSysCmdUpdateMeter, i
       
                Set oContact = oGAL.Item(i)
                If oContact.AddressEntryUserType = 0 Then
                    Set oUser = oContact.GetExchangeUser
                   ' If Len(oUser.LastName) > 0 Then
                   Debug.Print oUser.FirstName
                   If oUser.LastName = "Blechinger" And oUser.FirstName = "Heinz" Then
                   MsgBox oUser.Fristname
                        UserIndex = UserIndex + 1
                        rs.AddNew
                      
                            'rs![Key-GAL] = UserIndex
                            rs!FamilyName = oUser.LastName
                            rs!FirstName = oUser.FirstName
                           ' rs!EmailAddress = oUser.PrimarySmtpAddress
                          '  rs!Alias = oUser.Alias
                           ' rs!Location = oUser.City
                           ' rs!department = oUser.department
                            'rs!PhoneNumber = oUser.BusinessTelephoneNumber
                            'rs!LastUpdate = Date
                        rs.Update
                        Debug.Print "User: " & UserIndex & oUser.LastName & " wurde geschrieben."
                    End If
                End If
          Next i
            rs.Close
            SysCmd acSysCmdRemoveMeter
       
            appOL.Quit
       
            Set appOL = Nothing
            Set oGAL = Nothing
            Set oContact = Nothing
            Set oUser = Nothing
            Erase arrUsers
                
            'Set DB = Nothing
            'Set rs = Nothing
           
           Err.Clear  ' Vorherige Fehlernummer löschen
        
        End If 'End if of the "Is Outlook open" check
    Else
        MsgBox "You quit refreshing tbl_GAL.", vbOKOnly
   End If
End Sub

Ich erhalte keine Fehlermeldung(Laufzeitfehler oder Beschreibung), es tut sich nichts, auch keine Einträge im Direktfenster.

Bitte entschuldigt mein Ungeschicklichkeit bei der Fragestellung.


Ihre Antwort
  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen
Thema: Name: Email:



  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen

Thema Datum  Von Nutzer Rating
Antwort
13.04.2023 14:42:57 Blechinger
NotSolved
13.04.2023 16:09:19 Ulrich
NotSolved
14.04.2023 12:29:04 Blechinger
NotSolved
14.04.2023 12:40:58 Gast3239
NotSolved
Rot Access vba Daten aus Outlook Gal
14.04.2023 13:26:21 Blechinger
NotSolved
15.04.2023 11:18:05 Ulrich
NotSolved
15.04.2023 22:28:26 blechinger
NotSolved
16.04.2023 15:31:54 ralf_b
NotSolved
17.04.2023 08:18:19 Blechinger
NotSolved
17.04.2023 19:52:04 ralf_b
*****
Solved
18.04.2023 09:20:15 Blechinger
NotSolved
18.04.2023 13:42:02 Blechinger
NotSolved
18.04.2023 21:17:30 Blechinger
NotSolved