Slt,
Comme tout l'temps, un petit fichier excel light, sans donnees confidentielles, pour expliquer ton besoin...
++
Function excelpro(structure As String, nom As String, prenom As String)
Select Case structure
Case "prenomnom"
excelpro = prenom & nom
Case "pnom"
excelpro = Left(prenom, 1) & nom
Case "prenom"
excelpro = prenom
Case "nom"
excelpro = nom
Case "prenom_nom"
excelpro = prenom & "_" & nom
Case "p.nom"
excelpro = Left(prenom, 1) & "." & nom
Case "pn"
excelpro = Left(prenom, 1) & Left(nom, 1)
Case "nom.p"
excelpro = nom & "." & Left(prenom, 1)
End Select
End Function
Function excelpro(structure As String, nom As String, prenom As String)
Select Case structure
Case "prenomnom"
excelpro = prenom & nom
Case "pnom"
excelpro = Left(prenom, 1) & nom
Case "prenom"
excelpro = prenom
Case "nom"
excelpro = nom
Case "prenom_nom"
excelpro = prenom & "_" & nom
Case "p.nom"
excelpro = Left(prenom, 1) & "." & nom
Case "pn"
excelpro = Left(prenom, 1) & Left(nom, 1)
Case "nom.p"
excelpro = nom & "." & Left(prenom, 1)
Case "nom.prenom"
excelpro = nom & "." & prenom
Case "nom-pr"
excelpro = nom & "-" & Left(prenom, 2)
Case "nomp"
excelpro = nom & Left(prenom, 1)
Case "p-nom"
excelpro = Left(prenom, 1) & "-" & nom
Case "prenom-nom"
excelpro = prenom & "-" & nom
Case "prenomn"
excelpro = prenom & nom
End Select
End Function
=SUBSTITUE(SUBSTITUE(SUBSTITUE(SUBSTITUE(SUBSTITUE(SUBSTITUE($I3;"nom";CAR(1));"prenom";CAR(2));"p";CAR(3));CAR(1);$D3);CAR(2);$E3);CAR(3);GAUCHE($E3;1))
=SUBSTITUE(SUBSTITUE(SUBSTITUE(SUBSTITUE(SUBSTITUE(SUBSTITUE($I3;"nom";"#1");"prenom";"#2");"p";"#3");"#1";$D3);"#2";$E3);"#3";GAUCHE($E3;1))
=SUBSTITUE(SUBSTITUE(SUBSTITUE($I4;"#Nm";$D4);"#Pn";$E4);"#IP";GAUCHE($E4;1))
Function AdrEMail(ByVal Masque As String, ByVal Nom As String, ByVal Prénom As String)
Dim P As Long, C As String * 1, Lettre As Boolean, Déjà As Boolean, InitPrén As String
If InStr(Masque, "#IP") Then
For P = 1 To Len(Prénom)
C = Mid$(Prénom, P, 1)
Lettre = UCase(C) <> LCase(C)
If Lettre Then
If Not Déjà Then InitPrén = InitPrén & C
Déjà = True
Else
Déjà = False: End If: Next P: End If
AdrEMail = Replace(Replace(Replace(Masque, "#IP", InitPrén), "#Nm", Nom), "#Pn", Prénom)
End Function
Function AdrEMail(ByVal Masque As String, ByVal Nom As String, ByVal Prénom As String, _
ByVal Domain As String)
Dim P As Long, C As String * 1, Lettre As Boolean, Déjà As Boolean, InitPrén As String
If InStr(Masque, "prenom") = 0 Then Masque = Replace(Masque, "p", "¶")
If InStr(Masque, "¶") Then
For P = 1 To Len(Prénom)
C = Mid$(Prénom, P, 1)
Lettre = UCase(C) <> LCase(C)
If Lettre Then
If Not Déjà Then InitPrén = InitPrén & C
Déjà = True
Else
Déjà = False: End If: Next P: End If
AdrEMail = Replace(Replace(Replace(Masque, "nom", Nom), "prenom", Prénom), _
"¶", InitPrén) & "@" & Domain
End Function