Consulting

Results 1 to 12 of 12

Thread: Macro to change language for all boxes in a presentation

  1. #1
    VBAX Regular
    Joined
    Nov 2021
    Posts
    7
    Location

    Macro to change language for all boxes in a presentation

    Hello everybody,

    I have been struggling with a problem for a while. I have some presentations in spanish, but powerpoint (on Macbook) detects it as english and marks all words as spelling mistakes. I need to be able to mark all the boxes from all the slides as "Spanish" to make the spelling mistake detections disappear and make Powerpoint understand that the whole presentation is in Spanish. I have tried all "simple" solutions for a while without success, and I am now asking for help to build a macro to do it. I have seen in the youtube video (link below) that they have built such a macro working on Microsoft, and I would need the same for Macbook.

    Is anybody here able to help me?

    link:
    https://www.youtube.com/watch?v=ME1EPXFe_fc

  2. #2
    Moderator VBAX Guru Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    4,178
    Location
    Does this work?
    Option Explicit
    Public Sub ChangeSpellCheckingLanguage()
    Dim j as Integer
    Dim k as Integer
    Dim scount as Integer
    Dim fcount as Integer
    scount = ActivePresentation.Slides.Count
    For j = 1 to scount 
       fcount = ActivePresentation.Slides(j).Shapes.Count
          For k = 1 to fcount
             If ActivePresentation.Slides(j).Shapes(k).HasTextFrame Then
                ActicePresentation.Slides(j).Shapes(k).TextFrame2.TextRange.LanguageID = msoLanguageIdSpanish
             End If
         Next k
    Next j
    End Sub
    Remember To Do the Following....
    Use tags when posting code to the thread,
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  3. #3
    VBAX Regular
    Joined
    Nov 2021
    Posts
    7
    Location
    OMG YOU ARE THE BEST
    You cannot imagine how much that helps me
    Is there any tipping system in this kind of website ?

  4. #4
    Moderator VBAX Guru Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    4,178
    Location
    Not for me my friend. I simply went online and researched the issue for you.
    Remember To Do the Following....
    Use tags when posting code to the thread,
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  5. #5
    VBAX Regular
    Joined
    Nov 2021
    Posts
    7
    Location
    Quote Originally Posted by Aussiebear View Post
    Not for me my friend. I simply went online and researched the issue for you.
    Thank you very much!

  6. #6
    VBAX Regular
    Joined
    Nov 2021
    Posts
    7
    Location
    Quote Originally Posted by Aussiebear View Post
    Does this work?
    Option Explicit
    Public Sub ChangeSpellCheckingLanguage()
    Dim j as Integer
    Dim k as Integer
    Dim scount as Integer
    Dim fcount as Integer
    scount = ActivePresentation.Slides.Count
    For j = 1 to scount 
       fcount = ActivePresentation.Slides(j).Shapes.Count
          For k = 1 to fcount
             If ActivePresentation.Slides(j).Shapes(k).HasTextFrame Then
                ActicePresentation.Slides(j).Shapes(k).TextFrame2.TextRange.LanguageID = msoLanguageIdSpanish
             End If
         Next k
    Next j
    End Sub
    Hi Aussiebear, thanks again, you macro is helping me a lot I have a question: do you know how to also include the "notes" section in the macro? (the part at the bottom of every slide?)

  7. #7
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,054
    Location
    Try this

    Sub toSpanish()
    Dim osld As Slide
    Dim oshp As Shape
    For Each osld In ActivePresentation.Slides
    For Each oshp In osld.Shapes
    If oshp.HasTextFrame Then
    oshp.TextFrame.TextRange.LanguageID = msoLanguageIDSpanish
    End If
    Next oshp
    For Each oshp In osld.NotesPage.Shapes
    If oshp.HasTextFrame Then
    oshp.TextFrame.TextRange.LanguageID = msoLanguageIDSpanish
    End If
    Next oshp
    Next osld
    End Sub
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  8. #8
    VBAX Regular
    Joined
    Nov 2021
    Posts
    7
    Location
    Quote Originally Posted by John Wilson View Post
    Try this

    Sub toSpanish()
    Dim osld As Slide
    Dim oshp As Shape
    For Each osld In ActivePresentation.Slides
    For Each oshp In osld.Shapes
    If oshp.HasTextFrame Then
    oshp.TextFrame.TextRange.LanguageID = msoLanguageIDSpanish
    End If
    Next oshp
    For Each oshp In osld.NotesPage.Shapes
    If oshp.HasTextFrame Then
    oshp.TextFrame.TextRange.LanguageID = msoLanguageIDSpanish
    End If
    Next oshp
    Next osld
    End Sub
    Thank you John but it doesn't work: i've put in color the text that powerpoint told me there is a problem with (see above)

  9. #9
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,054
    Location
    Pretty sure it does work

    Did you copy paste the code?
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  10. #10
    VBAX Regular
    Joined
    Nov 2021
    Posts
    7
    Location
    Quote Originally Posted by John Wilson View Post
    Pretty sure it does work

    Did you copy paste the code?
    Yes here is the copy screen. Could the reason be that I am working on a Macbook?

    Captura de Pantalla 2022-09-26 a las 22.12.57.jpg

  11. #11
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,054
    Location
    It could be because you have a Mac. I know that LanguageID wasn't supported in earlier Mac VBA but I thought it was fixed in newer versions. You may need to work with TextRange2 like this

    Sub toSpanish()
    Dim osld As Slide
    Dim oshp As Shape
    For Each osld In ActivePresentation.Slides
    For Each oshp In osld.Shapes
    If oshp.HasTextFrame Then
    oshp.TextFrame2.TextRange.LanguageID = msoLanguageIDSpanish
    End If
    Next oshp
    For Each oshp In osld.NotesPage.Shapes
    If oshp.HasTextFrame Then
    oshp.TextFrame2.TextRange.LanguageID = msoLanguageIDSpanish
    End If
    Next oshp
    Next osld
     End Sub
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  12. #12
    VBAX Regular
    Joined
    Nov 2021
    Posts
    7
    Location
    Quote Originally Posted by John Wilson View Post
    It could be because you have a Mac. I know that LanguageID wasn't supported in earlier Mac VBA but I thought it was fixed in newer versions. You may need to work with TextRange2 like this

    Sub toSpanish()
    Dim osld As Slide
    Dim oshp As Shape
    For Each osld In ActivePresentation.Slides
    For Each oshp In osld.Shapes
    If oshp.HasTextFrame Then
    oshp.TextFrame2.TextRange.LanguageID = msoLanguageIDSpanish
    End If
    Next oshp
    For Each oshp In osld.NotesPage.Shapes
    If oshp.HasTextFrame Then
    oshp.TextFrame2.TextRange.LanguageID = msoLanguageIDSpanish
    End If
    Next oshp
    Next osld
     End Sub
    That works thank you John!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •