Bonjour a tous,
J aimerais ecrire un programme qui s executera la nuit a mon abcence pour exporter les emails outlook vers une feuille de calcul excel.
Le code suivant fonctionne bien mais chaque fois il faut fournir le nom utilisateur outlook et le mot de passe Entrust pour les emails cryptes:
Quelqu un aurait-t-il une solution pour eviter que le mot de passe et le nom utilisateur soient demandes? Nous fonctionnons avec un serveur Exchange.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36 Sub Auto_Open() On Error Resume Next Dim emailcount As Integer Dim OLF As Outlook.MAPIFolder Dim ol As New Outlook.Application 'OLF is declared as mapi folder to decide'which folder you want to target Set OLF = ol.Application.GetNamespace("MAPI").GetDefaultFolder(olFolderSentMail) 'OLF.Items.Count provide the number of mail present in inbox emailcount = OLF.Items.Count 'by i=1 we 'are initializing the variable by value 1'else it will throw an error i = 1 'Here I am using do while - loop to'Browse through all mail Do While i <= emailcount Sheet3.Cells(i + 1, 1) = OLF.Items(i).SenderEmailAddress Sheet3.Cells(i + 1, 2) = OLF.Items(i).SenderName Sheet3.Cells(i + 1, 3) = OLF.Items(i).SentOn 'Sheet3.Cells(i + 1, 4) = OLF.Items(i).Body i = i + 1 Loop 'Like SenderEmailAddress SenderName SentOn'we can use other properties of email to get other 'details Set OLF = Nothing Set ol = Nothing MsgBox " Export completed!" End Sub
Merci beaucoup d avance pour votre aide.
GuestCam
Partager