salut,

J'utilise le code suivant pour envoyer un mail à une personne spécifique. Le soucis est que j'ai un graphe dynamique sur ma feuille excel qui se trouve dans mon HTML range "B6:R41", mais ce dernier ne me l'affiche pas sur outlook (ci-bas un visuel de l'affichage), j'ai droit au petit carré avec la croix rouge.
Je vous joint ci-dessous le code.

Sauriez-vous me dire si l'anomalie est lié à mon code ou autre chose svp? je sèche complètement dessus.

Nom : Anomalie mail.PNG
Affichages : 262
Taille : 41,5 Ko

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
Public Sub Mail_PROD()
    Dim objOutlook As Object, objMail As Object
 
    Set objOutlook = CreateObject(Class:="Outlook.Application")
    Set objMail = objOutlook.CreateItem(0)
 
    With objMail
        .To = Sheets("TRD_INDIVIDUEL").Range("B4") '.Value
        .CC = ""
        .Subject = Sheets("TRD_INDIVIDUEL").Range("C4").Value
        .HTMLBody = fncRangeToHtml("TRD_INDIVIDUEL", "B6:R41")
 
 
    '.Display
    .Send
 
    End With
 
    Set objMail = Nothing
    Set objOutlook = Nothing
 
End Sub
 
 
Private Function fncRangeToHtml( _
    strWorksheetName As String, _
    strRangeAddress As String) As String
 
    Dim objFilesytem As Object, objTextstream As Object, objShape As Shape
    Dim strFilename As String, strTempText As String
    Dim blnRangeContainsShapes As Boolean
 
    strFilename = Environ$("temp") & "\" & _
        Format(Now, "dd-mm-yy_h-mm-ss") & ".htm"
 
    ThisWorkbook.PublishObjects.Add( _
        SourceType:=xlSourceRange, _
        Filename:=strFilename, _
        Sheet:=strWorksheetName, _
        Source:=strRangeAddress, _
        HtmlType:=xlHtmlStatic).Publish True
 
    Set objFilesytem = CreateObject("Scripting.FileSystemObject")
    Set objTextstream = objFilesytem.GetFile(strFilename).OpenAsTextStream(1, -2)
    strTempText = objTextstream.ReadAll
    objTextstream.Close
 
   ' For Each objShape In Worksheets(strWorksheetName).Shapes
   '     If Not Intersect(objShape.TopLeftCell, Worksheets( _
   '         strWorksheetName).Range(strRangeAddress)) Is Nothing Then
 
  '          blnRangeContainsShapes = True
  '          Exit For
  '
  '      End If
  ''  Next
 
 '   If blnRangeContainsShapes Then _
   '     strTempText = fncConvertPictureToMail(strTempText, Worksheets(strWorksheetName))
 
    fncRangeToHtml = strTempText
 '   fncRangeToHtml = Replace(fncRangeToHtml, "align=center x:publishsource=", "align=left x:publishsource=")
 
  '  Set objTextstream = Nothing
  '  Set objFilesytem = Nothing
 
  '  Kill strFilename
 
End Function