PowerPoint only provides the ability to change selected text to a specific
Language ID setting and, since you cannot always select all text in a
presentation at the same time you cannot change the language of all text in
a presentation in one step (without using VBA or add-ins).
Q245468 - Sample Code to Change the Language ID of a Text Box
http://support.microsoft.com/?id=245468
Thank you for your post. I started with that code, and expanded it
quite a bit. There's either a bug or some bad practice in the sample
code. When I used:
If shp.Type = msoTextBox Or msoPlaceholder Then
for checking items inside groups, it executed the "then" clause for an
oval autoshape in the group, and the code that changed the Language ID
wound up changing the size and shape of the oval! The following works
much better:
If (shp.Type = msoTextBox) Or (shp.Type = msoPlaceholder) Then
I also found that, in Office 2000, programmatically or manually
changing the language ID has no effect unless there is some text in
the box
For future generations <grin> the following changes the language ID to
US English in all text boxes and placeholders, even ones inside
groups, except the various masters:
Option Explicit
Public Sub ChangeLanguageID()
Dim oSld As Slide
Dim oShp As Shape
Dim NewLanguageID As Long
Dim GroupItemCount As Long
Dim GroupItem As Long
' Change as desired for different languages
NewLanguageID = msoLanguageIDEnglishUS
For Each oSld In ActivePresentation.Slides
' First the slides
For Each oShp In oSld.Shapes
' If it's a group ...
If oShp.Type = msoGroup Then
' We need to iterate through the objects in the group
GroupItemCount = oShp.GroupItems.Count
For GroupItem = 1 To GroupItemCount
DoChangeLanguageID oShp.GroupItems(GroupItem), NewLanguageID
Next GroupItem
Else
' It's not a group, just do it
DoChangeLanguageID oShp, NewLanguageID
End If
Next oShp
' Now the notes pages
For Each oShp In oSld.NotesPage.Shapes
DoChangeLanguageID oShp, NewLanguageID
Next oShp
Next oSld
End Sub
' Returns True if the shape's language ID was changed, False otherwise
Function DoChangeLanguageID(oShp As Shape, NewLanguageID As Long) As
Boolean
DoChangeLanguageID = False
If ((oShp.Type = msoTextBox) Or (oShp.Type = msoPlaceholder)) _
And oShp.HasTextFrame Then
' It's not going to work (at least in Office 2000)
' unless there's some text.
' If there's no text ...
If oShp.TextFrame.TextRange.Text = "" Then
' Temporarily insert some text
oShp.TextFrame.TextRange.Text = " "
' Do the change
oShp.TextFrame.TextRange.LanguageID = NewLanguageID
' Restore the null text
oShp.TextFrame.TextRange.Text = ""
DoChangeLanguageID = True
Else
' Just do the change
oShp.TextFrame.TextRange.LanguageID = NewLanguageID
DoChangeLanguageID = True
End If
End If
End Function