toutes les infos sur les Pieces jointes d'un document
j'ai pas trouver plus simple et efficasse que l'evaluate.
- Code : Tout sélectionner
Function File_PJ_Info(wDoc As NotesDocument) As Variant
'Cette fonction renvois les infos concernant les pieces jointes
'Déclaration des Variables
Dim lstValue List As String
Dim vrValue As Variant
Dim Separator As String
On Error Goto ErreurHandle
lstValue("NOMBRE")="0"
lstValue("NOM") = ""
lstValue("TAILLE") = "0"
lstValue("TOTAL") = "0"
If wDoc Is Nothing Then
Error 9999,"wDoc is Nothing"
Exit Function
End If
'détect si il ya des pieices jointes dans le document
If wDoc.HasEmbedded = False Then
File_PJ_Info = lstValue
Erase lstValue
Exit Function
End If
Separator = ";"
'évalue le nombre de pieices jointes
vrValue = Evaluate("@text(@Attachments)",wDoc)
lstValue("NOMBRE")= Trim(Cstr(vrValue(0)))
'si le nomnre de pieice jointe est zéro pas besoin d'evaluerle reste
If lstValue("NOMBRE")<> "0" Then
'évalue le nom des pieices jointes
vrValue = Evaluate({@implode(@AttachmentNames;"}+Separator+{")},wDoc)
lstValue("NOM")= Cstr(vrValue(0))
'evalue la taille de chaque pieice jointe
vrValue = Evaluate({@implode(@text(@AttachmentLengths);"}+Separator+{")},wDoc)
lstValue("TAILLE")= Trim(Cstr(vrValue(0)))
'evalue la taille total des pieices jointes
vrValue = Evaluate({@text(@Sum(@AttachmentLengths))},wDoc)
lstValue("TOTAL")= Trim(Cstr(vrValue(0)))
End If
vrValue = Null
File_PJ_Info = lstValue
Erase lstValue
Exit Function
ErreurHandle:
Msgbox "("+Cstr(Getthreadinfo (1))+" Call by "+Cstr(Getthreadinfo(10))+")"+Chr(10)+"Erreur " + Str(Err) + " : "+Chr(10) + Cstr(Error)+". "+Chr(10)+"Ligne N° "+Cstr(Erl),16," ERREUR !" lstValue("NOMBRE")="0"
lstValue("NOM") = ""
lstValue("TAILLE") = "0"
lstValue("TOTAL") = "0"
File_PJ_Info = lstValue
Erase lstValue
Exit Function
End Function