View Single Post
 
Old 11-24-2016, 10:31 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

The bolding of Hebrew fonts appears to have nothing to do with the content controls nor the macro, both of which are working correctly. If you type a simple length of Hebrew text, and bold that, it doesn't change, but the bold flag is set. I regret I don't know enough about the internal workings of fonts to explain this.

One answer is to use a contrasting font. For the purpose of experiment I downloaded the fonts Rubik and Suez One from http://freefonts.co.il/ and installed them in Windows. I then modified the code to switch the fonts as follows. This does work with your additional example, using a function to provide the formatting.

Code:
        Case "DDA"
            SetFont ContentControl.Range, "Suez One", True
            SetFont ActiveDocument.SelectContentControlsByTag("DDB").Item(1).Range
            SetFont ActiveDocument.SelectContentControlsByTag("DDC").Item(1).Range
            SetFont ActiveDocument.SelectContentControlsByTag("DDD").Item(1).Range
            SetFont ActiveDocument.SelectContentControlsByTag("DDE").Item(1).Range
            SetFont ActiveDocument.SelectContentControlsByTag("DDF").Item(1).Range
        Case "DDB"
            SetFont ContentControl.Range, "Suez One", True
            SetFont ActiveDocument.SelectContentControlsByTag("DDA").Item(1).Range
            SetFont ActiveDocument.SelectContentControlsByTag("DDC").Item(1).Range
            SetFont ActiveDocument.SelectContentControlsByTag("DDD").Item(1).Range
            SetFont ActiveDocument.SelectContentControlsByTag("DDE").Item(1).Range
            SetFont ActiveDocument.SelectContentControlsByTag("DDF").Item(1).Range
        Case "DDC"
            SetFont ContentControl.Range, "Suez One", True
            SetFont ActiveDocument.SelectContentControlsByTag("DDA").Item(1).Range
            SetFont ActiveDocument.SelectContentControlsByTag("DDB").Item(1).Range
            SetFont ActiveDocument.SelectContentControlsByTag("DDD").Item(1).Range
            SetFont ActiveDocument.SelectContentControlsByTag("DDE").Item(1).Range
            SetFont ActiveDocument.SelectContentControlsByTag("DDF").Item(1).Range
        Case "DDD"
            SetFont ContentControl.Range, "Suez One", True
            SetFont ActiveDocument.SelectContentControlsByTag("DDA").Item(1).Range
            SetFont ActiveDocument.SelectContentControlsByTag("DDB").Item(1).Range
            SetFont ActiveDocument.SelectContentControlsByTag("DDC").Item(1).Range
            SetFont ActiveDocument.SelectContentControlsByTag("DDE").Item(1).Range
            SetFont ActiveDocument.SelectContentControlsByTag("DDF").Item(1).Range
        Case "DDE"
            ContentControl.Range.Font.Name = "Suez One"
            ContentControl.Range.Font.Bold = True
            SetFont ActiveDocument.SelectContentControlsByTag("DDA").Item(1).Range
            SetFont ActiveDocument.SelectContentControlsByTag("DDB").Item(1).Range
            SetFont ActiveDocument.SelectContentControlsByTag("DDC").Item(1).Range
            SetFont ActiveDocument.SelectContentControlsByTag("DDD").Item(1).Range
            SetFont ActiveDocument.SelectContentControlsByTag("DDF").Item(1).Range
        Case "DDF"
            ContentControl.Range.Font.Name = "Suez One"
            ContentControl.Range.Font.Bold = True
            SetFont ActiveDocument.SelectContentControlsByTag("DDA").Item(1).Range
            SetFont ActiveDocument.SelectContentControlsByTag("DDB").Item(1).Range
            SetFont ActiveDocument.SelectContentControlsByTag("DDC").Item(1).Range
            SetFont ActiveDocument.SelectContentControlsByTag("DDD").Item(1).Range
            SetFont ActiveDocument.SelectContentControlsByTag("DDE").Item(1).Range
        Case Else
    End Select
End Sub

Sub SetFont(oRng As Range, Optional sFont As String = "Rubik", Optional bBold As Boolean)
    oRng.Font.Name = sFont
    oRng.Font.Bold = bBold
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote