2

I am working on a "fix language in entire document" script with a proper GUI for language selection. However, I am unable to programmatically generate a list of all languages PowerPoint knows including the language names in the user's own language.

For this reason, I am looking for the following:

  • A way to programmatically enumerate msoLanguageIds
  • A way to programmatically map msoLanguageIds to language names in the user's own language

In Word, I could use the Language object, but that doesn't seem to exist in PowerPoint.

Alternatively, a way to show the user a dialog that will set the DefaultLanguageID would be sufficient (I could grab the desired language from there).

I couldn't even find a way to set that via the GUI. Showing a similar language selector and getting the result would obviously do the job, too.

The target platform is Office 2007.

4

1 に答える 1

3

PowerPointマクロでLanguageオブジェクトを含むWordLanguagesコレクションを使用するのはどうですか?したがって、MsoLanguageID列挙値のLanguage-Nameを取得できます。ここでは、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

または、PowerPoint2016では次のようになります。

    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

于 2013-02-03T15:15:00.390 に答える