Bonjour Co_projet
Je propose le code VBA suivant:
Option Explicit
Sub GraphiqueToMht()
'Constante à adapter au contexte
Const cGraphName = "Graphique.Mht"
Const cSheetName = "Feuil2"
Dim oFS As Object
Dim oSheet As Worksheet
Dim oMht As PublishObject
Dim sChartName As String, sPath As String, sMhtName As String
'on recherche de chemin du bureau de l'utilisateur
sPath = CreateObject("WScript.Shell").specialfolders("Desktop")
sMhtName = sPath & "\" & cGraphName
Set oSheet = ThisWorkbook.Worksheets(cSheetName)
'on s'assure que la page WEB n'existe pas sinon on la supprime
Set oFS = CreateObject("Scripting.FileSystemObject")
If oFS.FileExists(sMhtName) Then
oFS.Deletefile sMhtName
End If
'on créé la page WEB
Set oMht = ThisWorkbook.PublishObjects.Add(xlSourceSheet, sMhtName, oSheet.Name, , xlHtmlStatic)
'on publie la page web
With oMht
.Publish (True)
End With
'On fait le menage
Set oSheet = Nothing
Set oMht = Nothing
Set oFS = Nothing
End Sub