'tout les arguments sont optional
Function arrangetext(txt, Optional couleur As Variant = "", Optional fontsiz As Long = 0, Optional fontName As String = "calibri", Optional bolder As Boolean = False, Optional italique As Boolean = False, Optional underligne As Boolean = False, Optional barré As Boolean = False)
Dim Fc As Object
With CreateObject("htmlfile")
Set Fc = .createelement("FONT")
If couleur <> "" Then Fc.Color = couleur
If fontsiz > 0 Then Fc.Style.fontsize = fontsiz & "px"
If barré Then txt = "<strike>" & txt & "</strike>"
If underligne Then txt = "<u>" & txt & "</u>"
If italique Then txt = "<em>" & txt & "</em>"
If bolder Then txt = "<strong>" & txt & "</strong>"
Fc.innerhtml = txt
If Not IsNull(Fc.getattribute("size")) Then Fc.removeAttribute ("size")
arrangetext = Fc.outerhtml
End With
End Function
Sub test()
Dim strbody$
strbody = "<p>"
strbody = strbody & arrangetext("Bonjour ", , , , True, True, True)
strbody = strbody & arrangetext("Raf26 ", "blue", 28, , True, , True) & "</br>"
strbody = strbody & arrangetext("comment va tu aujourd'hui", "red", , "Arial") & "</br>"
strbody = strbody & "tu t'éclate bien sur "
strbody = strbody & arrangetext("EXCELDOWNLOAD", "rgb(255,0,255)", 30, "Algerian", True)
strbody = strbody & "</p>"
MsgBox strbody
'test dans ton mail
End Sub