通过 VBA 更改 PowerPoint 中的语言仅在 macOS 中返回编译错误 [英] Changing language in PowerPoint through VBA returns compile error only in macOS

查看:46
本文介绍了通过 VBA 更改 PowerPoint 中的语言仅在 macOS 中返回编译错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个宏,可以更改 PPT 中所有元素(文本框、表格、组...)的更正语言.我最终得到了一个在 Windows 中运行良好的代码.但是,当宏在 macOS 中运行时,它会给出错误:

I have created a macro that changes the correction language of all the elements (text boxes, tables, groups...) in a PPT. I ended up with a code that works perfectly fine in Windows. However, when the macro runs in macOS it gives the error:

编译错误:未找到方法或数据成员

Compile error: Method or data member not found

并在行中突出显示.LanguageID":

Slides(i).Shapes(j).TextFrame.TextRange.LanguageID = iLanguageSelected

推荐答案

问题是在 16.9 版本之后的 PowerPoint 中 TextFrame 对象中没有包含 LanguageID 属性.

The problem is that the LanguageID property was not included in the TextFrame object in PowerPoint after version 16.9.

解决方法很简单,只需使用 TextFrame2 而不是 TextFrame:

The workaround is simple, just use TextFrame2 instead of TextFrame:

Slides(i).Shapes(j).TextFrame2.TextRange.LanguageID = iLanguageSelected

TextFrame2 在 Windows 中也能产生相同的结果,因此您可以为两个操作系统使用一个代码.

TextFrame2 also works with the same result in Windows so you can have one code for both OS.

来源:https://ourednik.info/maps/2011/04/11/change-the-language-to-englishus-on-all-slides-and-boxes-in-powerpoint-2007-or-2010/

这篇关于通过 VBA 更改 PowerPoint 中的语言仅在 macOS 中返回编译错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆