这看起来似乎微不足道,但对于我的生活,我无法弄清楚如何改变评论框的字体属性。 VBA代码的示例如下:
Sub SetCommentsProperties()
Dim Cell As Range
For Each Cell In Selection
If Not Cell.Comment Is Nothing Then
With Cell.Comment.Shape.TextFrame.Characters.Font
.ColorIndex = 3
.Size = 12
.Name = "Arial Black"
End With
End If
Next Cell
End Sub
然而,在C#VSTO中,我只能走到
Cell.Comment.Shape.TextFrame.Characters()
答案 0 :(得分:1)
这对我有用:
var selection = Globals.ThisAddIn.Application.Selection as Range;
var textFrame = selection.Comment.Shape.TextFrame;
textFrame.Characters().Font.ColorIndex = 3;
textFrame.Characters().Font.Size = 30;
您可以看到角色类here的所有成员。