OVH Cloud OVH Cloud

utiliser le carnet d'adresses de outlook dans excel

32 réponses
Avatar
Misange
Coucou
Tout est dans le titre... Comment récupérer dans excel les adresses qui
sont dans outlook ? J'ai cherché sur excelabo mais c'est un pur scandale
ça y est même pas !!!
idéalement ce serait bien d'y accéder via un menu déroulant.
Il ne s'agit PAS de faire du publipostage mais juste d'incorporer une
adresse dans une feuille excel.
Merci de votre aide ;-)
--
Misange migrateuse
XlWiki : Participez à un travail collaboratif sur excel !
http://xlwiki.free.fr/wiki
http://www.excelabo.net

10 réponses

1 2 3 4
Avatar
JLuc
Misange avait soumis l'idée :
Reste à m'inspirer du formulaire de Jean Luc pour bisouiller un userform
permettant de choisir le contact et d'incorporer son adresse dans excel.


C'est exactement de cette façon dont je l'utilise, en passant par un
tableau.
Attention, pour ne pas passer trop de temps, il faut ouvrir Outlook
avant, sinon, c'est assez long

--
JLuc

Avatar
Misange
Bon sang mais c'est bien sur !!

Misange migrateuse
XlWiki : Participez à un travail collaboratif sur excel !
http://xlwiki.free.fr/wiki
http://www.excelabo.net

| la macro de Denis rale sur
| Dim objApp As Outlook.Application
| ...Type non défini


Tu dois ajouter la bibliothèque "Microsoft Outlook x Librairy"




Avatar
free
Bonjour ,

peut-on aussi récuperer la liste des messages recu par

OUTLOOK , dans EXCEL ?

ce serait pour une automatisation.

merci
Avatar
JB
Bonjour Misange,

Liste triée des contacts dans un formulaire:
Pour récupérer le formulaire dans un classeur Excel, utiiliser
Exporter/Importer formulaire.

http://cjoint.com/?lxfPfkbKKn

Private Sub UserForm_Initialize()
' Outils/Référence OutLook
Dim Tbl()
Dim olNS As Outlook.Namespace
Set olApp = New Outlook.Application
Set olNS = olApp.GetNamespace("MAPI")
Set Contacts = olNS.GetDefaultFolder(olFolderContacts)
Set LItems = Contacts.Items
n = 0
For Each i In LItems
ReDim Preserve Tbl(0 To 2, 0 To n)
Tbl(0, n) = i.FirstName
Tbl(1, n) = i.LastName
Tbl(2, n) = i.Email1Address
n = n + 1
Next
Tri Tbl()
Me.ListBox1.List = Application.Transpose(Tbl)
End Sub

Sub Tri(table())
xn = UBound(table, 2)
ecart = xn ' tri shell
Do While ecart >= 1
ecart = ecart 2
inv = True
Do While inv
inv = False
For i = 0 To xn - ecart
j = i + ecart
If table(0, j) < table(0, i) Then
temp = table(0, j): table(0, j) = table(0, i): table(0, i) =
temp
temp = table(1, j): table(1, j) = table(1, i): table(1, i) =
temp
temp = table(2, j): table(2, j) = table(2, i): table(2, i) =
temp
inv = True
End If
Next
Loop
Loop
End Sub

Private Sub ListBox1_Click()
[A1] = ListBox1
[A2] = ListBox1.Column(1)
[A3] = ListBox1.Column(2)
End Sub

JB


Coucou
Tout est dans le titre... Comment récupérer dans excel les adresses q ui
sont dans outlook ? J'ai cherché sur excelabo mais c'est un pur scandale
ça y est même pas !!!
idéalement ce serait bien d'y accéder via un menu déroulant.
Il ne s'agit PAS de faire du publipostage mais juste d'incorporer une
adresse dans une feuille excel.
Merci de votre aide ;-)
--
Misange migrateuse
XlWiki : Participez à un travail collaboratif sur excel !
http://xlwiki.free.fr/wiki
http://www.excelabo.net


Avatar
JLuc
*Bonjour JB*,
Ta petite appli m'a l'air interessante.
Pour utiliser ton code, il faut "Microsoft Outlook 11.0 Object Library"
Comme je n'ai que office 2000 (9.0), que faut il modifier pour
l'utiliser ?

Bonjour Misange,

Liste triée des contacts dans un formulaire:
Pour récupérer le formulaire dans un classeur Excel, utiiliser
Exporter/Importer formulaire.

http://cjoint.com/?lxfPfkbKKn

Private Sub UserForm_Initialize()
' Outils/Référence OutLook
Dim Tbl()
Dim olNS As Outlook.Namespace
Set olApp = New Outlook.Application
Set olNS = olApp.GetNamespace("MAPI")
Set Contacts = olNS.GetDefaultFolder(olFolderContacts)
Set LItems = Contacts.Items
n = 0
For Each i In LItems
ReDim Preserve Tbl(0 To 2, 0 To n)
Tbl(0, n) = i.FirstName
Tbl(1, n) = i.LastName
Tbl(2, n) = i.Email1Address
n = n + 1
Next
Tri Tbl()
Me.ListBox1.List = Application.Transpose(Tbl)
End Sub

Sub Tri(table())
xn = UBound(table, 2)
ecart = xn ' tri shell
Do While ecart >= 1
ecart = ecart 2
inv = True
Do While inv
inv = False
For i = 0 To xn - ecart
j = i + ecart
If table(0, j) < table(0, i) Then
temp = table(0, j): table(0, j) = table(0, i): table(0, i) > temp
temp = table(1, j): table(1, j) = table(1, i): table(1, i) > temp
temp = table(2, j): table(2, j) = table(2, i): table(2, i) > temp
inv = True
End If
Next
Loop
Loop
End Sub

Private Sub ListBox1_Click()
[A1] = ListBox1
[A2] = ListBox1.Column(1)
[A3] = ListBox1.Column(2)
End Sub

JB


Coucou
Tout est dans le titre... Comment récupérer dans excel les adresses qui
sont dans outlook ? J'ai cherché sur excelabo mais c'est un pur scandale
ça y est même pas !!!
idéalement ce serait bien d'y accéder via un menu déroulant.
Il ne s'agit PAS de faire du publipostage mais juste d'incorporer une
adresse dans une feuille excel.
Merci de votre aide ;-)
--
Misange migrateuse
XlWiki : Participez à un travail collaboratif sur excel !
http://xlwiki.free.fr/wiki
http://www.excelabo.net



--
____
( O | O )
--
_oooO_ JLuc _Oooo_

O-O


Avatar
JB
Bonjour Jluc,

Je n'ai pas d'autre version d'OutLook pour tester. Je suis surpris que
la syntaxe ne soit pas la même.

Autre version:(les contacts sont mémorisés dans une feuille Contacts.
Ajouter un bouton pour rafraichier ou supprimer la feuille contacts)

http://cjoint.com/?lxiGo0EFAT

Private Sub UserForm_Initialize()
On Error Resume Next
temp = Sheets("contacts").Range("a1")
If Err <> 0 Then
Sheets.Add after:=Sheets(Sheets.Count)
ActiveSheet.Name = "Contacts"
LitOutLook
Sheets(1).Select
End If
Me.ListBox1.RowSource = "Contacts!A1:C" &
Sheets("contacts").[a65000].End(xlUp).Row
End Sub

Sub LitOutLook()
Dim olNS As Outlook.Namespace
Set olApp = New Outlook.Application
Set olNS = olApp.GetNamespace("MAPI")
Set Contacts = olNS.GetDefaultFolder(olFolderContacts)
Set LItems = Contacts.Items
n = 1
For Each i In LItems
Sheets("contacts").Cells(n, 1) = i.FirstName
Sheets("contacts").Cells(n, 2) = i.LastName
Sheets("contacts").Cells(n, 3) = i.Email1Address
n = n + 1
Next
Sheets("contacts").[A1].Sort key1:=Sheets("contacts").[A1]
End Sub

Private Sub ListBox1_Click()
[A1] = ListBox1
[A2] = ListBox1.Column(1)
[A3] = ListBox1.Column(2)
End Sub

JB

*Bonjour JB*,
Ta petite appli m'a l'air interessante.
Pour utiliser ton code, il faut "Microsoft Outlook 11.0 Object Library"
Comme je n'ai que office 2000 (9.0), que faut il modifier pour
l'utiliser ?

Bonjour Misange,

Liste triée des contacts dans un formulaire:
Pour récupérer le formulaire dans un classeur Excel, utiiliser
Exporter/Importer formulaire.

http://cjoint.com/?lxfPfkbKKn

Private Sub UserForm_Initialize()
' Outils/Référence OutLook
Dim Tbl()
Dim olNS As Outlook.Namespace
Set olApp = New Outlook.Application
Set olNS = olApp.GetNamespace("MAPI")
Set Contacts = olNS.GetDefaultFolder(olFolderContacts)
Set LItems = Contacts.Items
n = 0
For Each i In LItems
ReDim Preserve Tbl(0 To 2, 0 To n)
Tbl(0, n) = i.FirstName
Tbl(1, n) = i.LastName
Tbl(2, n) = i.Email1Address
n = n + 1
Next
Tri Tbl()
Me.ListBox1.List = Application.Transpose(Tbl)
End Sub

Sub Tri(table())
xn = UBound(table, 2)
ecart = xn ' tri shell
Do While ecart >= 1
ecart = ecart 2
inv = True
Do While inv
inv = False
For i = 0 To xn - ecart
j = i + ecart
If table(0, j) < table(0, i) Then
temp = table(0, j): table(0, j) = table(0, i): table(0, i) =
temp
temp = table(1, j): table(1, j) = table(1, i): table(1, i) =
temp
temp = table(2, j): table(2, j) = table(2, i): table(2, i) =
temp
inv = True
End If
Next
Loop
Loop
End Sub

Private Sub ListBox1_Click()
[A1] = ListBox1
[A2] = ListBox1.Column(1)
[A3] = ListBox1.Column(2)
End Sub

JB


Coucou
Tout est dans le titre... Comment récupérer dans excel les adresse s qui
sont dans outlook ? J'ai cherché sur excelabo mais c'est un pur scan dale
ça y est même pas !!!
idéalement ce serait bien d'y accéder via un menu déroulant.
Il ne s'agit PAS de faire du publipostage mais juste d'incorporer une
adresse dans une feuille excel.
Merci de votre aide ;-)
--
Misange migrateuse
XlWiki : Participez à un travail collaboratif sur excel !
http://xlwiki.free.fr/wiki
http://www.excelabo.net



--
____
( O | O )
--
_oooO_ JLuc _Oooo_

O-O




Avatar
MichDenis
| Pour utiliser ton code, il faut "Microsoft Outlook 11.0 Object Library"
| Comme je n'ai que office 2000 (9.0), que faut il modifier pour
| l'utiliser ?

Tu dois simplement modifier la bibliothèque.

Tu ouvres l'éditeur de code, outils , référence et tu coches
la version de la bibliothèque que tu as :

"Microsoft Outlook X.0 Librairy"
Avatar
Misange
Bonjour JB
Merci de te pencher aussi sur le problème !
J'obtiens un "propriété ou méthode non gérée par cet objet" à
l'affichage du userform. En suivant pas à pas, il semble que les
éléments des contacts ne soient pas intégrés dans le tableau, car
"indice n'appartient pas à la sélection".
JE suis avec outlook 2002 et en cochant la bonne librairie ca colle (ça
c'est pour répondre à Jean luc)

Misange migrateuse
XlWiki : Participez à un travail collaboratif sur excel !
http://xlwiki.free.fr/wiki
http://www.excelabo.net

Bonjour Misange,

Liste triée des contacts dans un formulaire:
Pour récupérer le formulaire dans un classeur Excel, utiiliser
Exporter/Importer formulaire.

http://cjoint.com/?lxfPfkbKKn

Private Sub UserForm_Initialize()
' Outils/Référence OutLook
Dim Tbl()
Dim olNS As Outlook.Namespace
Set olApp = New Outlook.Application
Set olNS = olApp.GetNamespace("MAPI")
Set Contacts = olNS.GetDefaultFolder(olFolderContacts)
Set LItems = Contacts.Items
n = 0
For Each i In LItems
ReDim Preserve Tbl(0 To 2, 0 To n)
Tbl(0, n) = i.FirstName
Tbl(1, n) = i.LastName
Tbl(2, n) = i.Email1Address
n = n + 1
Next
Tri Tbl()
Me.ListBox1.List = Application.Transpose(Tbl)
End Sub

Sub Tri(table())
xn = UBound(table, 2)
ecart = xn ' tri shell
Do While ecart >= 1
ecart = ecart 2
inv = True
Do While inv
inv = False
For i = 0 To xn - ecart
j = i + ecart
If table(0, j) < table(0, i) Then
temp = table(0, j): table(0, j) = table(0, i): table(0, i) > temp
temp = table(1, j): table(1, j) = table(1, i): table(1, i) > temp
temp = table(2, j): table(2, j) = table(2, i): table(2, i) > temp
inv = True
End If
Next
Loop
Loop
End Sub

Private Sub ListBox1_Click()
[A1] = ListBox1
[A2] = ListBox1.Column(1)
[A3] = ListBox1.Column(2)
End Sub

JB


Coucou
Tout est dans le titre... Comment récupérer dans excel les adresses qui
sont dans outlook ? J'ai cherché sur excelabo mais c'est un pur scandale
ça y est même pas !!!
idéalement ce serait bien d'y accéder via un menu déroulant.
Il ne s'agit PAS de faire du publipostage mais juste d'incorporer une
adresse dans une feuille excel.
Merci de votre aide ;-)
--
Misange migrateuse
XlWiki : Participez à un travail collaboratif sur excel !
http://xlwiki.free.fr/wiki
http://www.excelabo.net





Avatar
JLuc
*Bonjour JB*,
Merci, en rajoutant Outlook 9.0 ET en enlevant le manquant Outlook
10.0, ça marche


Bonjour Jluc,

Je n'ai pas d'autre version d'OutLook pour tester. Je suis surpris que
la syntaxe ne soit pas la même.

Autre version:(les contacts sont mémorisés dans une feuille Contacts.
Ajouter un bouton pour rafraichier ou supprimer la feuille contacts)

http://cjoint.com/?lxiGo0EFAT

Private Sub UserForm_Initialize()
On Error Resume Next
temp = Sheets("contacts").Range("a1")
If Err <> 0 Then
Sheets.Add after:=Sheets(Sheets.Count)
ActiveSheet.Name = "Contacts"
LitOutLook
Sheets(1).Select
End If
Me.ListBox1.RowSource = "Contacts!A1:C" &
Sheets("contacts").[a65000].End(xlUp).Row
End Sub

Sub LitOutLook()
Dim olNS As Outlook.Namespace
Set olApp = New Outlook.Application
Set olNS = olApp.GetNamespace("MAPI")
Set Contacts = olNS.GetDefaultFolder(olFolderContacts)
Set LItems = Contacts.Items
n = 1
For Each i In LItems
Sheets("contacts").Cells(n, 1) = i.FirstName
Sheets("contacts").Cells(n, 2) = i.LastName
Sheets("contacts").Cells(n, 3) = i.Email1Address
n = n + 1
Next
Sheets("contacts").[A1].Sort key1:=Sheets("contacts").[A1]
End Sub

Private Sub ListBox1_Click()
[A1] = ListBox1
[A2] = ListBox1.Column(1)
[A3] = ListBox1.Column(2)
End Sub

JB

*Bonjour JB*,
Ta petite appli m'a l'air interessante.
Pour utiliser ton code, il faut "Microsoft Outlook 11.0 Object Library"
Comme je n'ai que office 2000 (9.0), que faut il modifier pour
l'utiliser ?

Bonjour Misange,

Liste triée des contacts dans un formulaire:
Pour récupérer le formulaire dans un classeur Excel, utiiliser
Exporter/Importer formulaire.

http://cjoint.com/?lxfPfkbKKn

Private Sub UserForm_Initialize()
' Outils/Référence OutLook
Dim Tbl()
Dim olNS As Outlook.Namespace
Set olApp = New Outlook.Application
Set olNS = olApp.GetNamespace("MAPI")
Set Contacts = olNS.GetDefaultFolder(olFolderContacts)
Set LItems = Contacts.Items
n = 0
For Each i In LItems
ReDim Preserve Tbl(0 To 2, 0 To n)
Tbl(0, n) = i.FirstName
Tbl(1, n) = i.LastName
Tbl(2, n) = i.Email1Address
n = n + 1
Next
Tri Tbl()
Me.ListBox1.List = Application.Transpose(Tbl)
End Sub

Sub Tri(table())
xn = UBound(table, 2)
ecart = xn ' tri shell
Do While ecart >= 1
ecart = ecart 2
inv = True
Do While inv
inv = False
For i = 0 To xn - ecart
j = i + ecart
If table(0, j) < table(0, i) Then
temp = table(0, j): table(0, j) = table(0, i): table(0, i) >>> temp
temp = table(1, j): table(1, j) = table(1, i): table(1, i) >>> temp
temp = table(2, j): table(2, j) = table(2, i): table(2, i) >>> temp
inv = True
End If
Next
Loop
Loop
End Sub

Private Sub ListBox1_Click()
[A1] = ListBox1
[A2] = ListBox1.Column(1)
[A3] = ListBox1.Column(2)
End Sub

JB


Coucou
Tout est dans le titre... Comment récupérer dans excel les adresses qui
sont dans outlook ? J'ai cherché sur excelabo mais c'est un pur scandale
ça y est même pas !!!
idéalement ce serait bien d'y accéder via un menu déroulant.
Il ne s'agit PAS de faire du publipostage mais juste d'incorporer une
adresse dans une feuille excel.
Merci de votre aide ;-)
--
Misange migrateuse
XlWiki : Participez à un travail collaboratif sur excel !
http://xlwiki.free.fr/wiki
http://www.excelabo.net



--
____
( O | O )
--
_oooO_ JLuc _Oooo_

O-O



--
____
( O | O )
--
_oooO_ JLuc _Oooo_

O-O




Avatar
JLuc
*Bonjour MichDenis*,
Merci, ça ne marchais pas parce que je n'avais pas décocher
Manquant...10.0

Pour utiliser ton code, il faut "Microsoft Outlook 11.0 Object Library"
Comme je n'ai que office 2000 (9.0), que faut il modifier pour
l'utiliser ?


Tu dois simplement modifier la bibliothèque.

Tu ouvres l'éditeur de code, outils , référence et tu coches
la version de la bibliothèque que tu as :

"Microsoft Outlook X.0 Librairy"


--
____
( O | O )
--
_oooO_ JLuc _Oooo_

O-O


1 2 3 4