Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #16  
Old 11-24-2016, 10:56 AM
gwork gwork is offline How can I customize my own content controller for a word form in office 2013? Windows 7 64bit How can I customize my own content controller for a word form in office 2013? Office 2013
Novice
How can I customize my own content controller for a word form in office 2013?
 
Join Date: Nov 2016
Posts: 12
gwork is on a distinguished road
Default

And by the way, there is a font that has normal, bold etc versions, it's "Times New Roman". It does work on the English words but not on the Hebrew ones.

I have a different question: is there any line you can add to the code you wrote that'll "force" the code to work on ANY font?



If not, then I guess there's just an unsolved issue with this language.. since I tried ALL possible fonts + the code does work on any latin language (English, Spanish etc etc).

This is so unfortunate.
Reply With Quote
  #17  
Old 11-24-2016, 10:31 PM
gmayor's Avatar
gmayor gmayor is offline How can I customize my own content controller for a word form in office 2013? Windows 10 How can I customize my own content controller for a word form in office 2013? Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,137
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
  #18  
Old 11-25-2016, 05:14 AM
gwork gwork is offline How can I customize my own content controller for a word form in office 2013? Windows 7 64bit How can I customize my own content controller for a word form in office 2013? Office 2013
Novice
How can I customize my own content controller for a word form in office 2013?
 
Join Date: Nov 2016
Posts: 12
gwork is on a distinguished road
Default

This is SO funny. As I was going through all the fonts yesterday, I noticed that there are fonts that are bold by default, such as Aharoni, Secular One, or in your example- Suez One. So using contrasting fonts for the bolding to happen crossed my mind but then I thought it's probably not possible. BUT, since I know nothing about code writing, I had to give it a shot and so that's why I asked u if there was any way to make it happen, and well, my friend, you did it... you really did. This is a really smart bypass, and apparently it IS possible to write such a code, despite my thinking it wasn't.

I played around with your code and used Suez One + a different font instead of Rubik, and it all works perfectly!
Now I'm gonna set your code through my actual forms, see what the result looks like and let you know that it all worked etc.

This is genius, you're a genius and this forum rocks!
For reals, thank you so so much for everything!!
(You can mark this thread as "solved", as long as I'll still be able to come back here soon and write you that it all worked on my form etc)..
Reply With Quote
  #19  
Old 11-25-2016, 05:27 AM
gmayor's Avatar
gmayor gmayor is offline How can I customize my own content controller for a word form in office 2013? Windows 10 How can I customize my own content controller for a word form in office 2013? Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,137
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

You will have to mark it as solved.
__________________
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
  #20  
Old 11-29-2016, 02:28 PM
gwork gwork is offline How can I customize my own content controller for a word form in office 2013? Windows 7 64bit How can I customize my own content controller for a word form in office 2013? Office 2013
Novice
How can I customize my own content controller for a word form in office 2013?
 
Join Date: Nov 2016
Posts: 12
gwork is on a distinguished road
Default

Just wanted to let you know that everything worked great for me with that last method and code you've given me.
Thanks again for everything!
Reply With Quote
  #21  
Old 11-29-2016, 10:44 PM
gmayor's Avatar
gmayor gmayor is offline How can I customize my own content controller for a word form in office 2013? Windows 10 How can I customize my own content controller for a word form in office 2013? Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,137
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

If you are still watching, see http://www.gmayor.com/interactive_multichoice.html - I have created a process related to this thread, with much improved code, that you might find useful, and I could use the feedback.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com

Last edited by gmayor; 11-30-2016 at 07:42 AM.
Reply With Quote
Reply

Tags
controllers, customization, form

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Form with content controls - expands but at the bottom of the form louiseword Word 3 05-27-2016 12:47 AM
How can I customize my own content controller for a word form in office 2013? Content Control Field Names/Titles Word Form shammi_raj Word VBA 3 03-10-2016 02:54 AM
How can I customize my own content controller for a word form in office 2013? Finding field names in a Word-Form created by content control shammi_raj Word 1 03-10-2016 02:37 AM
How can I customize my own content controller for a word form in office 2013? Help with RichText Content Control in Word 2013 bsparacio311 Word 2 01-05-2015 03:38 PM
Who can help me customize the Outlook Contact layout form? WimYogya Outlook 0 03-08-2012 10:57 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:34 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft