Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

[VBA] Changer la police de caractère d'un commentaire

3 réponses
Avatar
HD
Bonjour,

Pour mettre un commentaire sur une cellule j'utilise ces lignes:

Cells(NbLi, NbCol).ClearComments
Cells(NbLi, NbCol).AddComment
Cells(NbLi, NbCol).Comment.Visible = False
Cells(NbLi, NbCol).Comment.Text Text:=TxtComt

Mais je voudrais mettre la police de caractère de ces commentaires en
"Courrier New" or si j'arrive à le modifier à la main je ne parviens pas à
le faire en VBA...

Avez vous une solution ?

Merci d'avance pour votre aide
--
@+
HD

3 réponses

Avatar
JB
Bonjour,

http://cjoint.com/?dxnykuIhuP

Sub essai()
On Error Resume Next
commentaire = "Ceci est un commentaire"
ActiveSheet.Cells(1, 1).AddComment ' Création commentaire
ActiveSheet.Cells(1,
1).Comment.Shape.OLEFormat.Object.Font.Name = "Tverdana"
ActiveSheet.Cells(1,
1).Comment.Shape.OLEFormat.Object.Font.Size = 7
ActiveSheet.Cells(1,
1).Comment.Shape.OLEFormat.Object.Font.FontStyle = "Normal"
ActiveSheet.Cells(1, 1).Comment.Text Text:=commentaire
ActiveSheet.Cells(1, 1).Comment.Visible = True
ActiveSheet.Cells(1, 1).Comment.Shape.Select
ActiveSheet.Selection.AutoSize = True
ActiveSheet.Cells(1, 1).Comment.Visible = False
End Sub

Cordialement JB
Avatar
HD
Un grand MERCI à toi JB !!! ça fonctionne bien !!!

--
@+
HD
Avatar
AV
Cells(NbLi, NbCol).Comment.Shape.OLEFormat.Object.Font.Name = "Courrier New"

AV