Private Sub CommandButton1_Click()
Dim Cod64$, ImG As Object, cc, chemin$
chemin = ThisWorkbook.Path & "\Penguins.jpg"
With WebBrowser1
.Navigate "about:blank"
Do While .ReadyState < 4: DoEvents: Loop
Set ImG = .Document.body.appendchild(.Document.createElement("img"))
.Document.body.appendchild (.Document.createElement("br"))
Do While .Busy: DoEvents: Loop
With ImG
.src = "data:image/" & "jpg" & ";base64," & Base64EncodeFile(chemin)
cc = Split(ImG.outerhtml, "base64,")(1)
t1 = "les 100 premiers caratères DU SRC DE L'IMAGE" & vbCrLf & Left(cc, 100)
t1 = t1 & vbCrLf & "*****************************************************************"
t1 = t1 & vbCrLf & "les 100 derniers caratères " & vbCrLf & Right(cc, 100)
t2 = "les 100 premiers caratères retournés par la fonction " & vbCrLf & Left(Base64EncodeFile(chemin), 100)
t2 = t2 & vbCrLf & "*****************************************************************"
t2 = t2 & vbCrLf & "les 100 derniers caratères " & vbCrLf & Right(Base64EncodeFile(chemin), 100)
.Height = 100
.Style.Border = "1pt solid red"
End With
Set div = .Document.body.appendchild(.Document.createElement("div"))
With div.Style: .overflow = "scroll": .WordWrap = "break-word": .Position = "absolute": .Width = 290: .Height = 100: .Left = 210: .Top = 10: End With
div.innerhtml = Base64EncodeFile(chemin)
x = .Document.body.innerhtml
.Document.write x
End With
End Sub