AW: Kommentarzeile verschieben
14.01.2021 15:24:59
Mullit
Hallo,
zugewiesen wird die Farbe hier:
Option Explicit
Public Sub test()
Dim strText As String, strLine As String
Dim lngPos As Long, lngColor As Long
With Tabelle1
With .Comments(1)
strText = .Text
lngPos = InStr(1, strText, vbLf & vbLf) + 1
lngColor = .Shape.TextFrame.Characters(Start:=1, Length:=lngPos).Font.Color
strLine = Left$(String:=strText, Length:=lngPos)
Call .Text(Text:=Mid$(String:=strText, Start:=lngPos + 1))
End With
With .Comments(2)
Call .Text(Text:=strLine, Start:=1, Overwrite:=False)
.Shape.TextFrame.Characters(Start:=1, Length:=lngPos). _
Font.Color = lngColor
End With
End With
End Sub
Ich lese aber vorher die Farbe in lngColor = ... ein, in Deiner Bsp.-mappe klappt das, wenn bei Dir da jetzt noch was grünes zw.-kommt, könnte es Probleme geben, Du kannst die Frabe auch ohne Einlesen direkt zu weisen:
.Shape.TextFrame.Characters(Start:=1, Length:=lngPos).Font.Color = vbRed
Sonst müsstest Du nochmal Deine Bsp.-mappe mit dem Grün-Prob. hochladen....;-)
Gruß, Mullit