问题
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