Target Application: Microsoft PowerPoint
Programming Language: VBA
Prerequisites: Developer Tools are enabled and VBA Editor is open (this post will show you how to do it).
Description: In this tutorial, we will write a VBA macro to change the proof reading language of a text frame. If you want to change the language on all objects in the presentation, you can use this tutorial as foundation. Simply embed the Private Function ChangeLanguage(tf)
and call it instead of or in addition to ChangeFont(tf)
.
Now we can start coding. I will describe the next steps directly in the code as comments, so you don’t have to put the different parts back together at the end. This way, you can copy the entire code and run it in your PowerPoint application.
To run the macro, simply click on the green play button at the top of the VBA Editor (or press F5 on your keyboard).
' This macro is brought to you by DG | ELEVATE YOUR BUSINESS ' Author: Daniel Glöckner ' Last update: 2022/03/03 ' Feel free to copy, use, adjust, and share ' Macro purpose: Change presentation language Option Explicit ' Forces all variables to be explicitly declared Sub ProcessSlides() ' Process all slides in presentation ' Define variables Dim sld As Slide Dim shp As Shape ' Process slides For Each sld In ActivePresentation.Slides ' Process all shapes on slide For Each shp In sld.Shapes If shp.HasTextFrame Then ChangeLanguage shp.TextFrame.TextRange End If Next shp Next sld End Sub Private Function ChangeLanguage(tf) ' Change text frame language ' Define variables Dim newLang As MsoLanguageID ' Change the language to US English ' NOTE: To change the language ID to another language, ' change the msoLanguageID value newLang = msoLanguageIDEnglishUS tf.LanguageID = newLang End Function