Friday, January 24, 2020

#1 2012-05-04 04:30:16 pm

Registered: 2012-05-04
Posts: 1

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"
   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
           tell shapes
           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

Filed under: vba, Powerpoint, languageid



#2 2012-06-16 10:14:40 am

Registered: 2010-08-31
Posts: 166

Re: Change Language in PowerPoint slides

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.





Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)