Changing language in PowerPoint through VBA returns compile error only in macOS

。_饼干妹妹 提交于 2020-06-17 15:49:31

问题


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

and highlights ".LanguageID" in the line:

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

回答1:


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

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

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

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

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



来源:https://stackoverflow.com/questions/62230925/changing-language-in-powerpoint-through-vba-returns-compile-error-only-in-macos

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