StartDownloadsServiceSamplesWorkshopsContact DeutschEnglish
 
Samples
General
Outlook®
 
Awarded by
Microsoft since 2005:
mvp logo
VBOffice Info
Visitors1752642
Impressions6572527
Links
Imprint
Privacy Policy
Contact
Contact: Edit company names
Author: Michael BauerHomepage
Date: 29.01.2006Accessed: 21601
  
Description

If you have two contacts in the same company, Outlook stores the company name twice. If you want to change the company name, you have to do that for each contact in that company.

If you have Outlook XP or newer, this example does the work for you. Once, all the contacts are found, you may also change other properties, of course.

' <DieseOutlookSitzung>
Option Explicit

Public Sub ChangeCompanyName()
  Dim sSearch As String
  Dim sFolder As String

  sFolder = "Kontakte"

  sSearch = InputBox("Company:")
  If Len(sSearch) Then
    ' Exakte Übereinstimmung im Firmennamen suchen
    sSearch = "urn:schemas:contacts:o = '" & sSearch & "'"
    Application.AdvancedSearch sFolder, sSearch
  End If
End Sub

Private Sub Application_AdvancedSearchComplete(ByVal SearchObject As Outlook.Search)
  If SearchObject.Results.Count Then
    ChangeNames SearchObject.Results
  End If
End Sub

Private Sub ChangeNames(Results As Outlook.Results)
  Dim obj As Object
  Dim oContact As Outlook.ContactItem
  Dim sNew As String

  sNew = InputBox("Neuer Name:")
  If Len(sNew) Then
    For Each obj In Results
      If TypeOf obj Is Outlook.ContactItem Then
        Set oContact = obj
        oContact.CompanyName = sNew
        oContact.Save
      End If
    Next
  End If
End Sub
' </DieseOutlookSitzung>

 
 

ReplyAll alerts you before unintentionally replying all, or if you are a confidential BCC recipient of the ... [more]

 

Access the master category list in the blink of an eye, share your categories in a network, get a reminder service, and ... [more]

 

SAM automatically sets the sender, signature, and folder for sent items, for instance based on the recipient ... [more]

 

OLKeeper reliably prevents users from closing their Outlook window and thus possibly missing reminders or ... [more]