Results 1 to 4 of 4
  1. #1
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Modifying ContactItem Property (Outlook 2000 SR-1)

    Warning: don't test this on real data in case it works! Make a copy of an Outlook Contacts folder to run it on.

    But for now it doesn't work. Main question: if objContactItem.BusinessFaxNumber, objContactItem.HomeFaxNumber and objContactItem.OtherFaxNumber are read-write strings, why isn't it changing them?

    Sub changecontactfax()
    Dim nsNS As NameSpace
    Dim fldrContFldr As MAPIFolder
    Dim itmContact As ContactItem
    Set nsNS = Application.GetNamespace("MAPI")
    Set fldrContFldr = nsNS.PickFolder

    If Not fldrContFldr Is Nothing Then
    If InStr(fldrContFldr.DefaultMessageClass, "Contact") > 0 Then
    For Each itmContact In fldrContFldr.Items
    On Error Resume Next
    With itmContact
    If Trim(.BusinessFaxNumber) <> "" Then _
    .BusinessFaxNumber = "Fax: " & .BusinessFaxNumber
    If Trim(.HomeFaxNumber) <> "" Then _
    .HomeFaxNumber = "Fax: " & .HomeFaxNumber
    If Trim(.OtherFaxNumber) <> "" Then _
    .OtherFaxNumber = "Fax: " & .OtherFaxNumber
    End With
    Next itmContact
    Else
    MsgBox fldrContFldr.Name & " is not a Contacts Folder" & vbLf & "Please choose a Contacts Folder"
    End If
    End If
    Set fldrContFldr = Nothing
    Set nsNS = Nothing
    End Sub

    Secondary question: to test that a contacts folder has been selected, is there a better technique than:

    If InStr(fldrContFldr.DefaultMessageClass, "Contact") > 0

    fldrContFldr.DefaultMessageClass returns "IPM.Contact".
    -John ... I float in liquid gardens
    UTC -7ąDS

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Modifying ContactItem Property (Outlook 2000 SR-1)

    Hi John,

    You don't save itmContact before moving on to the next one. Insert .Save just before End With.

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Modifying ContactItem Property (Outlook 2000 SR-1)

    John,

    Re your secondary question: you can also check the DefaultItemType:

    If fldrContFldr.DefaultItemType = olContactItem Then

  4. #4
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Modifying ContactItem Property (Outlook 2000 SR-1)

    Thanks on both counts!
    -John ... I float in liquid gardens
    UTC -7ąDS

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •