Consulting

Results 1 to 5 of 5

Thread: Font properties

  1. #1
    VBAX Regular
    Joined
    May 2018
    Posts
    6
    Location

    Font properties

    Hi All,

    I´m looking for a macro to change all content in Latin text to Complex script.


    This is very time consuming if we change it from the Font options. So basically, fonts and formats such as bold, italic or font size should remains as is. Just need the whole content is changed to Complex script.


    Is this feasible?

    Thanks!

  2. #2
    VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,273
    Location
    Cross-posted at: http://www.msofficeforums.com/word-v...ex-script.html
    Please read VBA Express' policy on Cross-Posting in Rule 3: http://www.vbaexpress.com/forum/faq...._new_faq_item3
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Have you googled this? There are many free online platforms that do this.
    Last edited by Aussiebear; 02-22-2025 at 02:26 AM.

  4. #4
    VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,273
    Location
    Quote Originally Posted by Wylsacom View Post
    There are many free online platforms that do this.
    Be that as it may, the OP clearly said:
    Quote Originally Posted by Fonsi View Post
    I´m looking for a macro to change all content in Latin text to Complex script.
    Kindly don't resurrect old threads (this one was last active more than two years ago) just to post advice that doesn't address the OP's needs.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  5. #5
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,391
    Location
    Perhaps try this:

    Sub ConvertLatinToComplex()
        Dim rng As Range
        Dim i As Long
        Dim charCode As Integer
        Set rng = ActiveDocument.Content
        ' Loop through each character in the document
        For i = rng.Characters.Count To 1 Step -1 
            ' Loop backwards to avoid index issues after changes
            charCode = AscW(rng.Characters(i).Text)
            ' Check if the character is within the Latin Unicode range (Basic Latin and Latin-1 Supplement)
            If (charCode >= 32 And charCode <= 255) Then 
                ' Basic Latin and Latin-1 Supplement
                ' Check if the character is not a control character.
                If (charCode >= 32) Then
                    ' Convert character to complex script. This forces Word to re-evaluate the character
                    ' and treat it as complex if applicable.
                    rng.Characters(i).Text = ChrW(charCode) & ChrW(8206) 
                    ' Add Left-to-Right Mark
                    rng.Characters(i).Characters(1).Delete 
                    ' Delete the added Left-to-Right Mark
                End If
            End If
        Next i
        Set rng = Nothing
    End Sub
    Remember To Do the Following....
    Use [Code].... [/Code] 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

Posting Permissions

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