VBA Powerpoint - How to highlight selected text

僤鯓⒐⒋嵵緔 提交于 2020-03-24 02:44:09

问题


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

Also can I trigger the macro using the a keyboard shortcut such as application onkeys on Excel ?

This would be great


回答1:


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)


来源:https://stackoverflow.com/questions/58175015/vba-powerpoint-how-to-highlight-selected-text

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!