Bonjour,
en m'inspirant d'un site : https://fr.extendoffice.com/document...f-folders.html, afin de créer un fichier texte récapitulatif , avec le nom des dossiers dans ma boite mail outlook, j'aimerais également avoir la taille des dossiers mais je n'y arrive pas.

voici mon code :
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
 
Dim gFileName, gCreateTree, gBase
 
Public Sub ExportFolderTree()
Dim objOutlook
Dim F, Folders
Dim Result
 
  Set objOutlook = CreateObject("Outlook.Application")
 
  Set F = objOutlook.Session.PickFolder
 
If Not F Is Nothing Then
Set Folders = F.Folders
 
    Result = MsgBox("Do you want to create tree?", vbYesNo + vbDefaultButton2 + vbApplicationModal, "Output Folder Tree")
If Result = 6 Then
gCreateTree = True
Else
gCreateTree = False
End If
 'GetDesktopFolder() &
    gFileName = "D:\outlook\Outlook-Folders.txt"
gBase = Len(F.FolderPath) - Len(Replace(F.FolderPath, "\", "")) + 1
 
WriteToATextFile (CreateFolderTree(F.FolderPath, F.Name))
 
 
 
LoopFolders Folders
 
Set F = Nothing
Set Folders = Nothing
Set objOutlook = Nothing
End If
End Sub
 
Private Function GetDesktopFolder()
Dim objShell
Set objShell = CreateObject("WScript.Shell")
GetDesktopFolder = objShell.SpecialFolders("Desktop")
Set objShell = Nothing
End Function
 
Private Sub LoopFolders(Folders)
Dim F
 
For Each F In Folders
WriteToATextFile (CreateFolderTree(F.FolderPath, F.Name))
LoopFolders F.Folders
Next
End Sub
 
Private Sub WriteToATextFile(OLKfoldername)
'gestoin du fichier de sortie
Dim objFSO, objTextFile
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile(gFileName, 8, True)
 
objTextFile.WriteLine (OLKfoldername)
objTextFile.Close
Set objFSO = Nothing
Set objTextFile = Nothing
End Sub
 
Private Function CreateFolderTree(OLKfolderpath, OLKfoldername)
 
If gCreateTree = False Then
CreateFolderTree = Mid(OLKfolderpath, 3)
Else
Dim i, x, OLKprefix
i = Len(OLKfolderpath) - Len(Replace(OLKfolderpath, "\", ""))
 
    For x = gBase To i
OLKprefix = OLKprefix & "-xx"
 
'OLKfolderpath renvoie mail\boite de reception\dossier
'OLKfoldername renvoie nom du dossier
 
Next
 
CreateFolderTree = OLKprefix & OLKfoldername
End If
End Function
Dans outlook 2016, j'ai été dans développeur puis j'ai créé un module et quand j'execute la macro, ça me genère un fichier texte, mais ça ne renvoie pas la taille du dossier, j'ai que le nom .

J'ai beau tenter de faire par exemple : OLKfoldername.SIze dans la procédure CreateFolderTree, mais j'ai une erreur .

Pourriez vous svp m'aider?
Un grand merci à vous.