AW: Mail aus Excel erstellen, mit Formatierung
volti
Hallo,
hier noch ein Beispiel mit Range2HTML. Da kannst Du auch Dein Replace anwenden.
.GetInspector
.HTMLBody = "Hallo<br>," & Replace( Range2Html(WSh2.Range(sBer)),"###","Anton") & .HTMLBody
Falls es doch Paste sein soll, melde Dich noch mal hier...
Code:
Private Function Range2Html(oBereich As Range) As String
' Gibt den angegebenen Bereich als HTML zurück, incl.Bilder
Dim sTmpDatei As String, sTmp As String, sTmpVz As String
Dim iff As Integer, P As Long
' Bereich in Datei exportieren
With oBereich
sTmpVz = Environ$("temp") & "\"
sTmpDatei = sTmpVz & Format(Now, "ddmmyy" & Int(Timer) * 10) & ".htm"
.Parent.Parent.PublishObjects.Add( _
SourceType:=xlSourceRange, _
Filename:=sTmpDatei, Sheet:=.Parent.Name, _
Source:=.Address, _
HtmlType:=xlHtmlStatic).Publish Create:=True
iff = FreeFile
Open sTmpDatei For Input As iff
Range2Html = Replace(Input(LOF(iff), iff), "align=center x:publishsource=", _
"align=left x:publishsource=")
Close iff
' Feststellen, ob auch Bilder im Bereich sind
P = InStr(1, Range2Html, "<link rel=File-List href=") + 26
If P > 26 Then
sTmp = Mid$(Range2Html, P, InStr(P, Range2Html, "/filelist.xml") - P)
Range2Html = Replace(Range2Html, sTmp, sTmpVz & sTmp)
End If
End With
On Error Resume Next
Kill sTmpDatei
Kill sTmpVz & sTmp
End Function
_________________________
viele Grüße aus Freigericht 😊
Karl-Heinz