AW: hier die getestete Version
17.11.2008 20:30:00
Tino
Hallo,
versuche es mal hiermit.
Es funktioniert aber nur bei von Hand eingefügter Zeilenumbrüchen,
dafür die Textboxeigenschaft EnterKeyBehavior auf True und MultiLine auf True setzen, jetzt kannst Du Zeilenumbrüche mit der Entertaste erzeugen.
Option Explicit
Private Sub CommandButton1_Click()
Dim strFarbe As String
Dim strText As String
Dim MyOutApp As Object, MyMessage As Object
strText = Replace(TextBox1, vbNewLine, "<br>")
strFarbe = Farbe_Hexa(TextBox1.ForeColor)
Set MyOutApp = CreateObject("Outlook.Application")
Set MyMessage = MyOutApp.CreateItem(0)
With MyMessage
.To = "Hier kommt die Adresse rein"
.Subject = "hier der Betreff"
.HTMLBody = "<font color=" & strFarbe & ">" & strText & "</font>"
.Importance = 2 'Wichtigkeit hoch
.Display
'.Send
End With
Set MyOutApp = Nothing
Set MyMessage = Nothing
End Sub
Function Farbe_Hexa(ByVal ZellFarb As Long) As String
Dim R, G, B As Long
R = Hex(ZellFarb - (ZellFarb \ 65536) * 65536 - _
((ZellFarb - (ZellFarb \ 65536) * 65536) \ 256) * 256)
G = Hex((ZellFarb - (ZellFarb \ 65536) * 65536) \ 256)
B = Hex(ZellFarb \ 65536)
If Len(R) < 2 Then R = R & "0"
If Len(G) < 2 Then G = G & "0"
If Len(B) < 2 Then B = B & "0"
Farbe_Hexa = "#" & R & G & B
End Function
Gruß Tino