Setting Proofing Language in PowerPoint
Lately I've been using PowerPoint a lot and, oftentimes, I need to set the proofing language of a presentation because I'm creating a slide in a language that is different from my Windows and PowerPoint.
So, following a post in StackOverflow I've created a “global” presentation that let me use a macro in all my presentations as this macro is not needed for the execution.
Second, with this post pointing me in the right direction I created the macro below, which I set to my Quick Access Toolbar, and all is well in my little presetation world.
Option Explicit
Public Sub SetProofingLanguageToPortuguese()
Call SetProofingLanguage(msoLanguageIDPortuguese)
End Sub
Public Sub SetProofingLanguageToEnglishUS()
Call SetProofingLanguage(msoLanguageIDEnglishUS)
End Sub
Private Sub SetProofingLanguage(langId As MsoLanguageID)
Dim ppt As Presentation
Dim sl As Slide
Dim sp As Shape
Dim gp As Shape
Set ppt = PowerPoint.ActivePresentation
For Each sl In ppt.Slides
For Each sp In sl.Shapes
Call SetShapeProofLang(sp, langId)
Next
Next
End Sub
Private Sub SetShapeProofLang(sp As Shape, langId As MsoLanguageID)
Select Case sp.Type
Case msoGroup
Dim shp As Shape
For Each shp In shp.GroupItems
Call SetShapeProofLang(shp, langId)
Next
Case msoTable
Dim r As Row
Dim c As Cell
For Each r In sp.Table.Rows
For Each c In r.Cells
Call SetShapeProofLang(c.Shape, langId)
Next
Next
Case Default
If (sp.HasTextFrame) Then
sp.TextFrame.TextRange.LanguageID = langId
End If
End Select
End Sub
Edited to add:
Unfortunately something went wrong, and although the macro works and does its job, the Add-In wasn't as successful. I can't seem to be able to make the Quick Access Toolbar buttons to call the macro when clicked, as I explained here.
Comments
Post a Comment