Results 1 to 8 of 8
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    read distribution list (2000 sr 1)

    i read and import into a sheet the user into adistribution list....
    is posisble to read the propety from each user into this list.?
    Sub ELENCO()

    Range("A2:B50000").ClearContents

    Set myOlApp = CreateObject("Outlook.Application")
    Set myNameSpace = myOlApp.GetNamespace("MAPI")
    Set myGAddressList = myNameSpace.AddressLists("Elenco Indirizzi Globale")
    Set myGEntries = myGAddressList.AddressEntries
    RIGA = 2

    For Each lista In myGEntries

    If lista = "A.T.C.B. - Utenti" Then

    Range("A" + RIGA) = lista

    For Each NOM In lista.Members
    Range("B" + RIGA) = UCase(NOM)
    RIGA = RIGA + 1
    Next NOM
    Exit For
    End If

    Next lista

    Range("A2").Select

    'Call Worksheet_SelectionChange

    MsgBox ("IMPORT TERMINATO!")

    End Sub

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

    Re: read distribution list (2000 sr 1)

    Yes, you can get the properties of NOM, such as Address

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: read distribution list (2000 sr 1)

    Yes... perfect!

  4. #4
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: read distribution list (2000 sr 1)

    Similar this, because have error "qualifier not valid... "for each line of range C D E F":

    Sub ELENCO()

    Range("A2:B50000").ClearContents

    Set myOlApp = CreateObject("Outlook.Application")
    Set myNameSpace = myOlApp.GetNamespace("MAPI")
    Set myGAddressList = myNameSpace.AddressLists("Elenco Indirizzi Globale")
    Set myGEntries = myGAddressList.AddressEntries
    RIGA = 2

    For Each lista In myGEntries

    If lista = "A.T.C.B. - Utenti" Then

    Range("A" + RIGA) = lista

    For Each NOM In lista.Members
    Range("B" + RIGA) = UCase(NOM)

    Range("C" + RIGA) = .FirstName
    Range("D" + RIGA) = .LastName
    Range("E" + RIGA) = .Email1Address
    Range("F" + RIGA) = .Categories

    RIGA = RIGA + 1
    Next NOM
    Exit For
    End If

    Next lista

    Range("A2").Select

    'Call Worksheet_SelectionChange

    MsgBox ("IMPORT TERMINATO!")

    End Sub

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

    Re: read distribution list (2000 sr 1)

    You must use NOM.FirstName etc.

  6. #6
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: read distribution list (2000 sr 1)

    Error: Propetry or metod not suported object "run time error 438"....
    Range("C" + RIGA) = NOM.FirstName
    But peraph i declare in italian FirstName = Cognome
    ???

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

    Re: read distribution list (2000 sr 1)

    No, VBA uses English, but FirstName apparently is not a property of a member of a distribution list. I have no time to look into it right now.

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

    Re: read distribution list (2000 sr 1)

    To get more information about a member of a distribution list, you have to find the corresponding contact item. This is fairly complicated, you can find sample code in <post:=349,321>post 349,321</post:>.

Posting Permissions

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