[英]Highlight instances of a word in Microsoft Word Document with VBA Including text boxes
[英]Highlight chart title in Word Document
我想突出显示图表标题文本(几个字符)。
ReplaceWhat = "Before"
ReplaceWith = "After"
If chrt.HasTitle Then
pos = InStr(chrt.ChartTitle.Characters.Text, ReplaceWhat)
If pos > 0 Then
chrt.ChartTitle.Characters(pos, Len(ReplaceWhat)).Text = ReplaceWith
chrt.ChartTitle.Characters(pos, Len(ReplaceWhat)).Font.Bold = msoTrue
End If
End If
我能够找到和替换图表标题文本,也能够使粗体。
用于更改文本颜色
chrt.ChartTitle.Format.TextFrame2.TextRange.Characters.Font.Fill.ForeColor.RGB = RGB(255, 255, 0)
未找到任何突出显示标题的解决方案。
也许试试这个:
Range("A1:A5").HighlightColorIndex = wdYellow
有一个 Range 的属性叫做 Range.HighlightColorIndex = //wdColorIndex//
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.