ggforum
Goto Top

Outlook 2007 Kontakte SPEICHERN UNTER für alle ändern per Makro

Probiere schon den ganzen Tag, habe anscheinend mit den IFs irgendwo ein Problem., sodaß definitiv der Kontaktname nicht im SaveAs Feld gespeichert wird.

Außerdem: Ich habe bisher nicht das Contactitem gefunden, das die Anrede enthält, denn es ärgert mich schon seit jahren, dass OL die Anrede nicht im Speichern unter als selection zuläßt.

Das Script
Sub SpUnterFirmaTest5()
Dim olExplorer As Explorer
Dim olfolder As MAPIFolder
Dim olSelection As Selection
    Set olExplorer = Application.ActiveExplorer
    Set olfolder = Application.ActiveExplorer.CurrentFolder
    Set olSelection = olExplorer.Selection
        For x = 1 To olSelection.Count
            SCompany = olSelection.Item(x).CompanyName
            SNameFull = olSelection.Item(x).LastFirstAndSuffix
            SNameFN = olSelection.Item(x).FirstName
            SNameLN = olSelection.Item(x).LastName
            STitle = olSelection.Item(x).Title
            SJob = olSelection.Item(x).JobTitle
                If Not IsNull(CompanyName) And Not IsNull(JobTitle) Then
                    olSelection.Item(x).FileAs = SCompany & " (" & SNameFull & ": " & SJob & ")"  
                ElseIf Not IsNull(CompanyName) And IsNull(JobTitle) Then
                    olSelection.Item(x).FileAs = SCompany & " (" & SNameFull & ")"  
                ElseIf IsNull(CompanyName) And Not IsNull(JobTitle) Then
                    olSelection.Item(x).FileAs = SNameFull & ": " & SJob  
                Else
                    olSelection.Item(x).FileAs = SNameFull
        End If
    olSelection.Item(x).Save
    Next x
End Sub
Was passiert:
1. Firma, Name und Postion vorhanden:
Karaca Architekten & Ingenieure (: NICHT GF) > Der Name des Kontaktes wird nicht angezeigt, aber die Position

2. Firma, Name vorhanden, NICHT Position
Lahmeyer Berlin GmbH Ingenieurgesellschaft (: )

3. Name , Position vorhanden, NICHT Firma
(: Inhaber) -> Der Name wird nicht angezeigt

4. Nur Name vorhanden
(: ) -> -> Der Name wird nicht angezeigt

Ich komm nicht dahinter, wo der Fehler liegt...
Kann da jemand weiterhelfen?

Content-Key: 176161

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

Printed on: April 19, 2024 at 19:04 o'clock