VBA Powerpoint - 如何突出显示选定的文本 [英] VBA Powerpoint - How to highlight selected text
本文介绍了VBA Powerpoint - 如何突出显示选定的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将所选文本突出显示为一种颜色,但这不起作用.你能帮我解决这个问题吗?
I would like to highlight the selected text into a colour but this is not working. Could you help me with that ?
Sub ShadingLtYellow()
ActiveWindow.Selection.TextRange.HighlightColor.RGB = RGB(255, 255, 175)
End Sub
我还可以使用键盘快捷键(例如 Excel 上的应用程序 onkeys)触发宏吗?
Also can I trigger the macro using the a keyboard shortcut such as application onkeys on Excel ?
这会很棒
推荐答案
TextRange 用于向后兼容旧版本的 PowerPoint.对于当前版本(2010 及更高版本),请改用 Textrange2 对象,它具有突出显示:
TextRange is for backward compatibility with older versions of PowerPoint. With current versions (2010 and later), use the Textrange2 object instead, it has Highlight:
ActiveWindow.Selection.TextRange2.Font.Highlight.RGB = RGB(255, 255, 175)
这篇关于VBA Powerpoint - 如何突出显示选定的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文