Private Declare Function StrFormatByteSize Lib "shlwapi" Alias "StrFormatByteSizeA" (ByVal dw As Long, ByVal pszBuf As String, ByVal cchBuf As Long) As Long
'retourne la taille d'un fichier se trouvant en sPath
Public Function TailleFichier(ByVal sPath As String) As String
Dim StrOut As String
Dim lSize As Long
'On vérifie si le fichier existe
If Dir(sPath) <> vbNullString Then
'on récupère sa taille
lSize = FileLen(sPath)
StrOut = Space(64)
'on la formate avec StrFormatByteSize
Call StrFormatByteSize(lSize, StrOut, Len(StrOut) - 1)
TailleFichier = Trim$(StrOut)
End If
End Function