You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

PowerPoint VBA运行时错误438:ChartTitle.TextFrame方法或数据成员未找到问题求助

PowerPoint VBA运行时错误438:ChartTitle.TextFrame方法或数据成员未找到问题求助

大家好,我在Mac上用最新版PowerPoint写VBA代码时碰到了运行时错误438,错误提示是Method or Data Member Not Found,触发错误的代码行是:Set chartTitleTextFrame = cChart.ChartTitle.TextFrame

下面是相关的代码片段:

' Check if the chart has a title
If cChart.HasTitle Then
    Set chartTitleTextFrame = cChart.ChartTitle.TextFrame
    ' Set chart title text and font properties
    With chartTitleTextFrame.TextRange.Font
        .Name = "Montserrat"
        .Bold = True
        .Size = 26
        .Color.RGB = RGB(107, 27, 85)
    End With

我特意核对了VBA对象模型的文档,按说cChart.ChartTitle是包含TextFrame属性的,但实际运行代码就是报错。要是把代码里的.TextFrame去掉,又会弹出错误13(类型不匹配)。我实在搞不清为什么在这个场景下访问不了TextFrame属性。

有没有大佬能帮我分析下可能的原因,以及对应的解决办法?真的非常感谢!

补充尝试过的操作与环境信息

  • 环境:Mac端最新版PowerPoint
  • 我已经尝试声明变量Dim chartTitleTextFrame As TextFrame,再赋值为cChart.ChartTitle.TextFrame,但还是报错
  • 也试过用.TextFrame2替换.TextFrame,问题依旧

如果需要更多细节,请随时告诉我!提前谢谢大家的帮忙!

备注:内容来源于stack exchange,提问作者Tyran

火山引擎 最新活动