S
SKYMAN
Guest
je voudrais savoir comment en VBa on peut creer un commentaire qui comporte plusieurs couleur, cela doit etre possible car on y arrive sans passer par les macros
Sub Bouton2_QuandClic()
With Range('a1')
If Not .Comment Is Nothing Then .Comment.Delete
.AddComment Text:='Salut'
With .Comment.Shape.OLEFormat.Object
.ShapeRange.Fill.ForeColor.SchemeColor = 52
.ShapeRange.Fill.BackColor.SchemeColor = 42
.ShapeRange.Fill.TwoColorGradient msoGradientHorizontal, 1
End With
End With
End Sub
Sub Bouton2_QuandClic()
With Range('a1')
If Not .Comment Is Nothing Then .Comment.Delete
.AddComment Text:='Salut'
With .Comment.Shape.OLEFormat.Object
.ShapeRange.Fill.PresetGradient msoGradientHorizontal, 4, _
msoGradientGoldII
End With
End With
End Sub
2004: -125.00
2005: +500.25
Sub Bouton1_QuandClic()
Dim texte As String
Dim i As Byte
Dim j As Byte
With Range('a1')
If .Comment Is Nothing Then Exit Sub
texte = .Comment.Text
For i = 1 To Len(texte)
If Mid(texte, i, 1) = '-' Then
For j = i + 1 To Len(texte)
If Asc(Mid(texte, j, 1)) = 10 Or j = Len(texte) Then
.Comment.Shape.TextFrame.Characters(i, j - i + 1).Font.Color = vbRed
Exit For
End If
Next j
End If
Next i
End With
End Sub