#1 13 Feb 2012 10:20

supprt avtis
Member
From: france
Registered: 05 Jan 2012
Posts: 4
Website

Change quickly one fields for every contact

exchange 2003 / outlook 2007 configured with exchange Account

this is my code

Public Sub ModifAuto()
        Dim myOlApp As Outlook.Application
        Dim myNamespace As Outlook.NameSpace
        Dim myContacts As Outlook.Items
        Dim myContact As Object
        Dim myFolder As Outlook.MAPIFolder

       
        Set myOlApp = CreateObject("Outlook.Application")
        Set myNamespace = myOlApp.GetNamespace("MAPI")
        Set myFolder = myNamespace.GetDefaultFolder(olFolderContacts).Folders("")
        Set myContacts = myFolder.Items

        For Each myContact In myContacts
            If (myContact.Class = olContact) Then
                If (myContact.LastName <> "" Or myContact.FirstName <> "") Then
                    myContact.Email1DisplayName = myContact.Email
                Else
                    myContact.Email1DisplayName = myContact.Email
                End If
                myContact.Save
            End If
        Next
        MsgBox "Opération effectuée."
    End Sub

I wish to replace fields " to post(show) as " by simply that the e-mail address

but i don't undertand and I do not know what to put EXACTLY between the quotation marks of this code

Set myFolder = myNamespace.GetDefaultFolder(olFolderContacts).Folders("????")

Needs it to put the whole road of the file .NK2?
what exactly ?

thanks

Offline

#2 14 Feb 2012 12:44

supprt avtis
Member
From: france
Registered: 05 Jan 2012
Posts: 4
Website

Re: Change quickly one fields for every contact

I removed the partie.folders what gives

Set myFolder = myNamespace.GetDefaultFolder(olFolderContacts)

cause i have not sub-files contacs

but now the script stop here :

myContact.Email1DisplayName = myContact.Email

whit the error :

Error of execution 438 property or method not managed by this object

what can i do ?

Offline

Board footer

Powered by FluxBB