Change Language in PowerPoint slides

Whenever you create a new TextFrame using VBA in PowerPoint 2011, for some reason, the language defaults to English. In Windows, you could use the “LanguageID” property of the TextRange object to correct this, however Microsoft did not implement this property of the TextRange object in VBA for Mac.

The solution presented here uses AppleScript to change the language of all slides to Portuguese. Hope it is useful to someone!


tell application "Microsoft PowerPoint"
	activate
	
	set theView to view of document window 1
	
	repeat with slideNumber from 1 to count of slides of active presentation
		
		go to slide theView number slideNumber
		
		tell slide slideNumber of active presentation
			activate
			tell shapes
				select
			end tell
		end tell
		tell application "System Events"
			tell process "Microsoft PowerPoint"
				tell menu bar 1
					tell menu bar item "Tools"
						tell menu "Tools"
							click menu item 5
						end tell
					end tell
				end tell
			end tell
			tell window 1 of process "Microsoft PowerPoint"
				tell outline 1 of scroll area 1
					select (first row whose value of static text 1 is "Portuguese (Portugal)")
				end tell
				click button "OK"
			end tell
		end tell
		
	end repeat
end tell

Does anyone know how to modify this so that should it fail to select the correct language for some reason you can stop it, select the right one, and set it going again without having to start the script over again?

I’ve not been able to get it to do this so far.

Thanks,

Bowjest