【问题标题】:How to change the font of a selection in powerpoint 2013 with VBA如何使用 VBA 在 powerpoint 2013 中更改选择的字体
【发布时间】:2017-03-08 10:58:05
【问题描述】:

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

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

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

【问题讨论】:

  • 我不确定,但我认为它就像 selection.style.fontfamily= "Courier New" .fontstyle=Bold 或 font.bold=true

标签: vba powerpoint-2013


【解决方案1】:

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

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

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

【讨论】:

  • 这不适用于 SmartArt 图形中的文本,知道如何解决这个问题吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-09-09
  • 2019-11-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-02-02
相关资源
最近更新 更多