+ Reply to Thread
Results 1 to 4 of 4

Change language

  1. #1
    Registered User
    Join Date
    01-11-2017
    Location
    London, England
    MS-Off Ver
    2003,2007,2010,2013
    Posts
    65

    Lightbulb Change language

    Hello,

    i'm seeking to modify the attached macro to change the language to in all slides to numbers only, this macro scopes all slides and shapes and changes the language for all text to be English US

    i just want it to scope all numbers only


    attached two sample files for before and after case.

    in before file you will find all text with numbers in English South Africa language

    in after file you will find all numbers set to English US and text still in English South Africa


    Sub SetLangUS()
    Dim scount, j, k, fcount
    scount = ActivePresentation.Slides.Count
    For j = 1 To scount
    fcount = ActivePresentation.Slides(j).Shapes.Count
    For k = 1 To fcount 'change all shapes:
    If ActivePresentation.Slides(j).Shapes(k).HasTextFrame Then
    ActivePresentation.Slides(j).Shapes(k).TextFrame _
    .TextRange.LanguageID = msoLanguageIDEnglishUS
    End If
    Next k
    fcount = ActivePresentation.Slides(j).NotesPage.Shapes.Count
    For k = 1 To fcount 'change all shapes:
    If ActivePresentation.Slides(j).NotesPage.Shapes(k).HasTextFrame Then
    ActivePresentation.Slides(j).NotesPage.Shapes(k).TextFrame _
    .TextRange.LanguageID = msoLanguageIDEnglishUS
    End If
    Next k
    Next j
    End Sub



    cross-posting link: here
    Attached Files Attached Files
    Last edited by Ethen5155; 01-13-2019 at 06:59 AM.

  2. #2
    Registered User
    Join Date
    01-11-2017
    Location
    London, England
    MS-Off Ver
    2003,2007,2010,2013
    Posts
    65

    Re: Change language

    Sub just_Numbers()
    Dim iCol As Integer
    Dim iRow As Integer
    Dim otbl As Table
    Dim osld As Slide
    Dim oshp As Shape
    For Each osld In ActivePresentation.Slides
    For Each oshp In osld.Shapes
    Select Case oshp.HasTable
    Case False
    If oshp.HasTextFrame Then
    If oshp.TextFrame.HasText Then Call fixLang(oshp)
    End If
    Case True
    Set otbl = oshp.Table
    For iRow = 1 To otbl.Rows.Count
    For iCol = 1 To otbl.Columns.Count
    If otbl.Cell(iRow, iCol).Shape.TextFrame.HasText Then Call _
    fixLang(otbl.Cell(iRow, iCol).Shape)
    Next iCol
    Next iRow
    End Select
    Next oshp
    Next osld
    End Sub


    Sub fixLang(oshp As Shape)
    Dim W As Long
    For W = 1 To oshp.TextFrame.TextRange.Words.Count
    If IsNumeric(oshp.TextFrame.TextRange.Words(W)) Then
    oshp.TextFrame.TextRange.Words(W).LanguageID = msoLanguageIDEnglishUS
    End If
    Next W
    End Sub

    This code can do most of numbers but two cases doesn't

    1- it doesn't apply on notes on every slide

    2- orders like (9:05 AM) , (1/14/2019) , (1-14-2019)

    can some one help to add regex pattern like:

    .Pattern = "[0-9]:[0-9]"
    .Pattern = "[0-9]/[0-9][0-9]/[0-9][0-9][0-9][0-9]"
    .Pattern = "[0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]"

    to be able to apply to all numbers orders in file??

  3. #3
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Change language

    Post Deleted
    Last edited by macropod; 01-15-2019 at 08:14 AM.
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  4. #4
    Registered User
    Join Date
    01-11-2017
    Location
    London, England
    MS-Off Ver
    2003,2007,2010,2013
    Posts
    65

    Re: Change language

    Hello Paul,

    yes i'm already added a a cross posted link on my main topic at both forums for the beginning, so what is the problem as i can't get it from your reply and of course and i didn't private message any admin or moderator about my topics!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Change Language
    By Dummy99 in forum Excel General
    Replies: 4
    Last Post: 05-03-2016, 08:54 AM
  2. Change Excel Language?
    By Drus in forum Excel General
    Replies: 4
    Last Post: 04-19-2015, 02:03 PM
  3. Change Button language according to Language Settings
    By Meithom in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-02-2015, 05:00 AM
  4. How to change main language?
    By ADB in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 12-11-2009, 02:12 AM
  5. [SOLVED] How can I programatically change the language in the language bar?
    By Roy Barr in forum Excel General
    Replies: 0
    Last Post: 03-14-2005, 06:06 PM
  6. How can I programatically change the language in the language bar?
    By Roy Barr in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-14-2005, 06:06 PM
  7. Replies: 2
    Last Post: 01-30-2005, 03:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1