Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Lire Mail avec Excel

1 réponse
Avatar
J&B
Bonjour,

J'utilises cette macro ci dessous pour récupérer chez jacques boisgontier
'Merci" et qui marche bien.
Par contre je souhaiterai que la lecture se fasse a partir d'un autre
repertoire au lieu de celui par défaut
J'ai essayé en modifiant la ligne :
Set olxFolder = olns.GetDefaultFolder(6)
par :
Set olxFolder = olns.GetDefaultFolder(olFolderInbox.Folder "toto")
Mais marche pas !!!!!!!!!!!

Merci de votre Aide
J&B
----------------------------------------------------------
Sub LitMessagerie()
Set olApp = CreateObject("Outlook.Application")
Set olns = olApp.GetNamespace("MAPI")
Set olxFolder = olns.GetDefaultFolder(6)
Sheets("Mail").Select
On Error Resume Next
n = 2
For Each i In olxFolder.Items
Cells(n, 1) = i.Subject
Cells(n, 2).ClearComments
Cells(n, 2).AddComment Text:=Replace(i.Body, Chr(13), "")
Cells(n, 2).Comment.Shape.Height = 150
Cells(n, 2).Comment.Shape.Width = 300
Cells(n, 3) = i.SenderName
Cells(n, 4) = i.CreationTime
n = n + 1
Next
End Sub

---------------------------------------------------------------------

1 réponse

Avatar
Daniel.C
Bonjour.
Remplace :
Set olxFolder = olns.GetDefaultFolder(6)

par :
Set olxFolder = olns.Folders(1).Folders("toto")
C'est valable si toto est un sous dossier de "dossiers personnels".
--
Cordialement.
Daniel
"J&B" a écrit dans le message de news:
48dd1d2e$0$20501$
Bonjour,

J'utilises cette macro ci dessous pour récupérer chez jacques boisgontier
'Merci" et qui marche bien.
Par contre je souhaiterai que la lecture se fasse a partir d'un autre
repertoire au lieu de celui par défaut
J'ai essayé en modifiant la ligne :
Set olxFolder = olns.GetDefaultFolder(6)
par :
Set olxFolder = olns.GetDefaultFolder(olFolderInbox.Folder "toto")
Mais marche pas !!!!!!!!!!!

Merci de votre Aide
J&B
----------------------------------------------------------
Sub LitMessagerie()
Set olApp = CreateObject("Outlook.Application")
Set olns = olApp.GetNamespace("MAPI")
Set olxFolder = olns.GetDefaultFolder(6)
Sheets("Mail").Select
On Error Resume Next
n = 2
For Each i In olxFolder.Items
Cells(n, 1) = i.Subject
Cells(n, 2).ClearComments
Cells(n, 2).AddComment Text:=Replace(i.Body, Chr(13), "")
Cells(n, 2).Comment.Shape.Height = 150
Cells(n, 2).Comment.Shape.Width = 300
Cells(n, 3) = i.SenderName
Cells(n, 4) = i.CreationTime
n = n + 1
Next
End Sub

---------------------------------------------------------------------