PDA

View Full Version : Import Property of User into Excel



sal21
11-11-2005, 08:04 AM
read and import into a sheet the user into adistribution list....
is posisble to read the propety from each user into this list and insert into cell.?

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

malik641
11-12-2005, 08:32 PM
Hey Sal :hi:

Sorry I haven't worked with Microsoft Outlook and VBA, but ..... if your code is correct...the only problem I see is:

Range("B" + RIGA) = UCase(NOM)
Should be:
Range("B" & RIGA).Value = UCase(NOM)

Otherwise the question I have for you is:
Where are you getting errors? If any :dunno

johnske
11-12-2005, 11:11 PM
Hey Sal :hi:

Sorry I haven't worked with Microsoft Outlook and VBA, but ..... if your code is correct...the only problem I see is:

Range("B" + RIGA) = UCase(NOM)
Should be:
Range("B" & RIGA).Value = UCase(NOM)
That shouldn't create a problem, Value is a the default property and usually is not required...

sal21
11-13-2005, 01:13 AM
That shouldn't create a problem, Value is a the default property and usually is not required...

i am sorry but my question not is on "value"...

My really question is:
is posisble to read the propety from each user into this list and insert into cell.?
for example: address, office, department, ID, email.address ecc...
Tks