如何使用 VBA 在 powerpoint 2013 中更改所选内容的字体

How to change the font of a selection in powerpoint 2013 with VBA

我想将 powerpoint 2013 中的文本选择更改为粗体和 "Couirier New"。我尝试使用这个 VBA 脚本来更改字体:

Sub chengeFont()
    With ActiveDocument.Selection
        With .Font
            .Name = "Courier New"
        End With
    End With
End Sub

但它不起作用。有什么建议么?

这将更改字体并在您 运行 时将其设为粗体

With ActiveWindow.Selection.TextRange.Font
    .Name = "Courier New"
    .Bold = msoTrue
End With

由于您是 运行 从选择中选择文档,因此文档应始终是活动文档,否则您将需要更改 ActiveWindow