Changing language for PowerPoint presentations

When you want to change the dictionary that is being used for a PowerPoint presentation, you might think that it is just to select all slides and change dictionary or enter some magic dialog where you find some setting for the current presentation, but this is where the problem occur and you realizes that it is not as easy as you might think.

Everything that appear in a PowerPoint slide are considered to be an object. This means that the title of the slide is an object as well as the text area where you have a bulleted list, the additional text areas, etc.. And if you think a little bit further you will soon realize that you need to select each object in each slide in order to change to the correct dictionary. Pheew!

Luckily there is always a way of scripting this, so I created a macro in VBA for PowerPoint that iterates through every slide in the presentation and changes dictionary for all objects found on the slide. The script is quite self-explanatory and you’ll find it below.

Sub SetLanguageIDEnglishUS()
    Dim slideCount, shapeCount, j, k
    slideCount = ActivePresentation.Slides.Count
    For j = 1 To slideCount
        
        ' Change dictionary for all shape objects
        shapeCount = ActivePresentation.Slides(j).Shapes.Count
        For k = 1 To shapeCount
            If ActivePresentation.Slides(j).Shapes(k).HasTextFrame Then
                ActivePresentation.Slides(j).Shapes(k).TextFrame _
                    .TextRange.LanguageID = msoLanguageIDEnglishUS ' msoLanguageIDSwedish
            End If
        Next k
        
        ' Change dictionary for all notes
        shapeCount = ActivePresentation.Slides(j).NotesPage.Shapes.Count
        For k = 1 To shapeCount
            If ActivePresentation.Slides(j).NotesPage.Shapes(k).HasTextFrame Then
                ActivePresentation.Slides(j).NotesPage.Shapes(k).TextFrame _
                    .TextRange.LanguageID = msoLanguageIDEnglishUS ' msoLanguageIDSwedish
            End If
        Next k
    Next j
End Sub
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s