Bonjour,

Mon problème est qu'il m'est impossible d'insérer la bordure du bas de mon tableau lorsque je l'insère dans le corps d'un mail.
Ce tableau est dans un Sheet sur une certaine rangée de cellules.

Voici un exemple pour illustrer mon propos :

(Corps du mail généré)

Bonjour,

Veuillez trouver ci-dessous le tableau :

________________
| xxx | yyyyyy |
----------------
| AAA | BBBB   |


-> Pas de bordure en BOTTOM de ce tableau

Code VBA qui génère ce mail avec le tableau :

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
Set rng = WB.Worksheets("Sheet1").Range("K1", WB.Worksheets("Sheet1").Range("N1").End(xlDown)).SpecialCells(xlCellTypeVisible)
'Set rng =  WB.Worksheets("Sheet1").Range("K1", WB.Worksheets("Sheet1").Range("N1").End(xlDown)).Cells 'testé mais sans succès
 
        With oBjMail
            .To = mesDestinaitaires
 
            .Subject = objetMail
 
            .HTMLBody = body_HTML_mail_Template() & RangetoHTML(rng)
 
            .Display
        End With
 
End Sub
 
 
Public Function RangetoHTML(rng As Range)
 
'=========== [STANDARD FUNCTION] ============
 
    Dim fso As Object
    Dim ts As Object
    Dim TempFile As String
    Dim TempWB As Workbook
 
    TempFile = Environ$("temp") & "/" & Format(Now, "dd-mm-yy h-mm-ss") & ".htm"
 
    'Copy the range and create a new workbook to past the data in
 
    rng.Copy
    Set TempWB = Workbooks.Add(1)
    With TempWB.Sheets(1)
        .Cells(1).PasteSpecial Paste:=8
        .Cells(1).PasteSpecial xlPasteValues, , False, False
        .Cells(1).PasteSpecial xlPasteFormats, , False, False
        .Cells(1).Select
        Application.CutCopyMode = False
        On Error Resume Next
        .DrawingObjects.Visible = True
        .DrawingObjects.Delete
        On Error GoTo 0
    End With
 
    'Publish the sheet to a htm file
    With TempWB.PublishObjects.Add( _
        SourceType:=xlSourceRange, _
        Filename:=TempFile, _
        Sheet:=TempWB.Sheets(1).Name, _
        Source:=TempWB.Sheets(1).UsedRange.Address, _
        HtmlType:=xlHtmlStatic)
        .Publish (True)
    End With
 
 
    'Read all data from the htm file into RangetoHTML
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set ts = fso.GetFile(TempFile).OpenAsTextStream(1, -2)
    RangetoHTML = ts.readall
    ts.Close
    RangetoHTML = Replace(RangetoHTML, "align=center x:publishsource=", _
    "align=left x:publishsource=")
 
    'Close TempWB
    TempWB.Close savechanges:=False
 
    'Delete the htm file we used in this function
    Kill TempFile
 
    Set ts = Nothing
    Set fso = Nothing
    Set TempWB = Nothing
 
End Function
Cela me prend bien l'intégralité du tableau SAUF la bordure du bas. J'ai essayé de la faire à la main avec une bordure fine et épaisse dans le mail mais toujours le même problème.

J'ai du manqué quelque chose...

Existerait-il sinon une autre alternative?

D'avance, merci pour vos réponses.

Rolf