在 PowerPoint 宏中使用包含 Language 对象的 Word Languages 集合怎么样?因此,您可以获得 MsoLanguageID 枚举值的语言名称。在这里您可以找到 Office 可用的语言。
' Powerpoint code
' add reference to word lib.
Public Sub test()
Dim wordAppliacation As New Word.Application
wordAppliacation.Visible = False
On Error Resume Next
Dim languageId As MsoLanguageID
For languageId = msoLanguageIDArabic To msoLanguageIDSpanishPuertoRico
Debug.Print languageId & ", " & wordAppliacation.Languages(languageId).Name & ", " & wordAppliacation.Languages(languageId).NameLocal
Next languageId
On Error GoTo 0
wordAppliacation.Quit
Set wordAppliacation = Nothing
End Sub
或者在 PowerPoint 2016 中可能就像这样:
Dim lng As Word.language
Dim lid As Long
For Each lng In wordAppliacation.Languages
lid = lng.id
Debug.Print lid & ", " & wordAppliacation.Languages(lid).Name & ", " & wordAppliacation.Languages(lid).NameLocal
Next lng