See updated version.
Working in an international environment, I need a lot of time to fix the language in a whole PowerPoint presentation. There is no built-in feature for this available. I share here my VBA based solution.
This feature is available in my PowerPoint Add-In (available in GitHub).
Working in an international environment, I need a lot of time to fix the language in a whole PowerPoint presentation. There is no built-in feature for this available. I share here my VBA based solution.
- Current situation
- VBA Code
- References
- PowerPoint-2007-set-language-on-tables-charts-etc-that-contains-text (StackOverflow)
- VBA PowerPoint 2013: Change presentation language including smartart objects (StackOverflow)
- PowerPoint 2007: Set-language for all text/
- Updated: PowerPoint: Change Presentation or Selected Slides Language | Thierry Dalon's Blog
Current situation
There are some commercial Add-Ins to achieve this. See for example: AddIn Lingo by PPTAlchemy to buy for 30USD (as of 2016-06-28).
I didn't want to pay for this. I looked for a solution in StackOverflow. (see references)
VBA Code
At the end I came to this VBA solution:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
Sub SetLangUS() | |
Call changeLanguage(ActivePresentation, "US") | |
End Sub | |
Sub SetLangUK() | |
Call changeLanguage(ActivePresentation, "UK") | |
End Sub | |
Sub SetLangDE() | |
Call changeLanguage(ActivePresentation, "DE") | |
End Sub | |
Sub SetLangFR() | |
Call changeLanguage(ActivePresentation, "FR") | |
End Sub | |
Private Function changeLanguage(oPres As Presentation, langStr As String) | |
' Reference http://stackoverflow.com/questions/4735765/powerpoint-2007-set-language-on-tables-charts-etc-that-contains-text | |
' http://stackoverflow.com/questions/37653183/vba-powerpoint-2013-change-presentation-language-including-smartart-objects | |
' https://support.microsoft.com/en-us/kb/245468 | |
On Error Resume Next | |
Dim r, c As Integer | |
Dim oSlide As Slide | |
Dim oNode As SmartArtNode | |
Dim oShape, oNodeShape As Shape | |
Dim lang As String | |
'lang = "Norwegian" | |
'Determine language selected | |
If langStr = "US" Then | |
lang = msoLanguageIDEnglishUS | |
ElseIf langStr = "UK" Then | |
lang = msoLanguageIDEnglishUK | |
ElseIf langStr = "DE" Then | |
lang = msoLanguageIDGerman | |
ElseIf langStr = "FR" Then | |
lang = msoLanguageIDFrench | |
End If | |
'Set default language in application | |
oPres.DefaultLanguageID = lang | |
'Set language in each textbox in each slide | |
For Each oSlide In oPres.Slides | |
For Each oShape In oSlide.Shapes | |
'Check first if it is a table | |
If oShape.HasTable Then | |
For r = 1 To oShape.Table.Rows.Count | |
For c = 1 To oShape.Table.Columns.Count | |
oShape.Table.Cell(r, c).Shape.TextFrame.TextRange.LanguageID = lang | |
Next | |
Next | |
ElseIf oShape.HasSmartArt Then | |
For Each oNode In oShape.SmartArt.AllNodes | |
oNode.TextFrame2.TextRange.LanguageID = lang | |
Next | |
Else | |
oShape.TextFrame.TextRange.LanguageID = lang | |
For c = 0 To oShape.GroupItems.Count - 1 | |
oShape.GroupItems(c).TextFrame.TextRange.LanguageID = lang | |
Next | |
End If | |
Next | |
Next | |
' Update Masters | |
For Each oShape In oPres.SlideMaster.Shapes | |
oShape.TextFrame.TextRange.LanguageID = lang | |
Next | |
For Each oShape In oPres.TitleMaster.Shapes | |
oShape.TextFrame.TextRange.LanguageID = lang | |
Next | |
For Each oShape In oPres.NotesMaster.Shapes | |
oShape.TextFrame.TextRange.LanguageID = lang | |
Next | |
' MsgBox | |
MsgBox "Presentation Language was changed to " & langStr & ".", vbOKOnly, "SetLanguage" | |
End Function |