Change the Spell Check Language on all slides in PowerPoint using VBA (2007 onwards)

 Dec 09, 2014

One limitation of PowerPoint is that you can only change the Spell Check Language for a one text box at a time; there is no way to set it for the entire presentation. This means that if you have a PowerPoint presentation created in the U.S. but you want the English to be Australian, you will need to change the spell check language for each text box individually. This can be frustrating and time consuming. Fortunately, a simple macro will help us get around this little problem. Here’s how to do it. Part 1: Create the macro
  1. Show the Developer tab in the Ribbon: go to File > Options > Customise Ribbon and in the right hand panel put a tick in the check box next to Developer. (For 2007 users click the Start button > Power Point Options > Popular and tick Show Developer Tab in Ribbon.) Change the Spell Check Language on all slides in PowerPoint using VBA (2007 onwards)
  1. Click the Visual Basic Button on the Developer tab to go to the VBA editor.
  2. In the VBA editor, click on the Insert menu and select Module to insert a new empty code module. Change the Spell Check Language on all slides in PowerPoint using VBA (2007 onwards)
  3. Type or paste the following code into the code panel (main section on the right): Option Explicit  Public Sub ChangeSpellCheckLanguage()       Dim nSlideCount As Integer    Dim nShapeCount As Integer    Dim nSlides As Integer    Dim nShapes As Integer    'Find out how many slides there are in the presentation     nSlides = ActivePresentation.Slides.Count     'Loop through all the slides     For nSlideCount = 1 To nSlides        'Find out how many shapes there are so identify all the text boxes         nShapes = ActivePresentation.Slides(nSlideCount).Shapes.Count         'Loop through all the shapes on that slide changing the language option         For nShapeCount = 1 To nShapes              If ActivePresentation.Slides(nSlideCount).Shapes(nShapeCount).HasTextFrame Then                  ActivePresentation.Slides(nSlideCount).Shapes(nShapeCount) _                  .TextFrame.TextRange.LanguageID = msoLanguageIDEnglishAUS              End If          Next nShapeCount      Next nSlideCount  End Sub
  4. In this example, we have set the language to English Australia. To change this to another language replace msoLanguageIDEnglishAUS with the desired language. The full list of languages can be found on this website.
  5. To run the macro, go to the Developer tab, click Macros, select ChangeSpellCheckLanguage and click Run. After that, all text elements within the presentation will have changed to use the new spelling language stipulated.
  6. Save your changes, but be aware that regular PowerPoint files (.pptx) cannot contain macros so you will need to save as a PowerPoint Macro-Enabled (.pptm) file. To do this click File, Save As and select PowerPoint Macro-Enabled Presentation from the Files of Type dropdown, give it a sensible name and click Save.
Part 2: Run the macro from the Quick Access Toolbar One way of making your macro easier to run is by adding it to your Quick Access Toolbar. To do this follow these steps:
  1. Go to the Quick Access Toolbar (small toolbar at the very top of the application) and click on the drop down to the right of it. Select More Commands.
  2. The Customise dialog will open. Where it says Choose Commands From: change the selection from Popular Commands to Macros. Then select your Macro and click the Add The macro should appear in the panel on the left.
  3. Click the Modify button to give it a different icon and description, then click OK to save your changes. Your selected icon will now appear on the Quick Access Toolbar and you can click on it to run your macro.
Note: The PowerPoint presentation containing the macro (code) will need to be open in order for the macro to be run in a different presentation, the way to get around this is to create an add-in and add it to the ribbon. Part 3: Create an ADD-IN and add it to the Ribbon Unlike the other Office programs, PowerPoint doesn't have a simple way to automatically run VBA code when you open a particular PPT file. To get around this, we can create an add-in that includes an Auto_Open subroutine. PowerPoint will run the code in Auto_Open when the add-in loads. Once loaded, an add-in will load itself every time PowerPoint starts up. To make our macro always available at the click of a button, we will also create a toolbar and add a button to it which will be associated with our macro. The new toolbar will appear on the Add-ins tab.
  1. Press Alt+F11 to go back to the VBA editor. After the end of the previous code, type or paste the following: Sub Auto_Open()   Dim oToolbar As CommandBar    Dim oButton As CommandBarButton    Dim MyToolbar As String     MyToolbar = "More Tools"    On Error Resume Next    ' Create the toolbar    Set oToolbar = CommandBars.Add(Name:=MyToolbar, _  Position:=msoBarFloating, Temporary:=True)    If Err.Number <> 0 Then  ' The toolbar's already there, so we have nothing to do  Exit Sub    End If     On Error GoTo ErrorHandler     'Add a button to the new toolbar    Set oButton = oToolbar.Controls.Add(Type:=msoControlButton)      ' Set the button's properties    With oButton           .DescriptionText = "Change Spell Check Language"          .Caption = "Change Spell Check Language"          .OnAction = "ChangeSpellCheckLanguage" 'Runs the code to change language          .Style = msoButtonIcon          .FaceId = 643          'Chooses icon #0643 POW, change to 59 for a smiley face     End With    oToolbar.Visible = True   NormalExit:    Exit Sub   ErrorHandler:      MsgBox Err.Number & vbCrLf & Err.Description      Resume NormalExit: End Sub
  2. Once you've added the code above and perhaps tested that it doesn’t have any errors, save your work as a PowerPoint Macro-Enabled (.pptm) file. In the next step we will be saving it as an add-in (.ppam) file, but PPAM files CANNOT be edited, so it is very important you have a PPTM version in case you need to edit your macro later
  3. To create the add-in, delete all the slides and then choose File, Save As and pick PowerPoint Add-In (*.ppam) from the Files of Type dropdown listbox. Give it a sensible name and save.
  4. You now have a new PowerPoint Add-in. Until you load it into PowerPoint, it's not going to do you much good, so the next step is to Load the Add-in.To load the add-in in PowerPoint 2007:
    • Click the Office Button, click PowerPoint Options and then click Add-ins.
    • Next to Manage: choose PowerPoint Add-Ins then click Go.
    • Click Add New and browse to your add-in.
    To load the add-in in PowerPoint 2010:
    • Click the File tab, click Options and then click Add-ins.
    • Next to Manage: choose PowerPoint Add-Ins then click Go.
    • Click Add New and browse to your add-in.

Change the Spell Check Language on all slides in PowerPoint using VBA (2007 onwards)

Change the Spell Check Language on all slides in PowerPoint using VBA (2007 onwards)

A new toolbar will now appear on the Add-Ins tab and you will be able to run your change language macro in any PowerPoint presentation. Part 4: Alternative Face IDs In the example code, we use a FaceID to stipulate what the icon should be on the Ribbon. Here are some other alternatives:

Change the Spell Check Language on all slides in PowerPoint using VBA (2007 onwards)

How do your Excel skills stack up?   

Test Now  

About the Author:

Nicky Bull  

Nicky started her professional life over 19 years ago in the IT industry. Through the initial years of her career, she worked in the areas of software development & project management for some of the leading organisations in South Africa and U.K. Over the past 6 years, Nicky has been working as a Desktop Applications trainer, delivering courses to both corporate as well as government organisations across the entire Microsoft Office suite. Her approach to training delivery is very pragmatic and she finds immense fulfilment in her ability to assist other people with their growth and development.

Read full bio
top
Back to top