[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 520
  • Last Modified:

In Word, can one apply a character style that does not change underlines?

     I frequently have brief comments in a Word document that include words that are possibly underlined, in italics, or in boldface. (See image 1, where one word is in italics and another word is underlined.) I wish to apply a predefined character style to the comment that will (a) change the font color and (b) apply a style to the comment such that I can hide or display all such comments by changing the “Hidden” status of the style.
      Currently when I apply such a pre-defined character style to such a comment, a style pre-defined by me, it removes any underlining or italics in the comment. (See image 2, where the font color is changed, but the underlining and italics are removed.)
      I would like to remove all font specifications in my pre-defined character style except for color or the “Hidden” status. Is that possible? I would be satisfied if I could simply not change any italics or underlining, but so far I have not succeeded.
      Is there any hope?
      —J.R.
      

31-03-2010-4-34-28-AM.png
31-03-2010-4-35-17-AM.png
0
JohnRobinAllen
Asked:
JohnRobinAllen
  • 4
  • 2
1 Solution
 
irudykCommented:
Unfortunately, styles can't be used in this way to accomplish what you are looking for. I'd think you would have to use a macros. One macro, to say apply just the font color to blue, and another to toggle all of the blue font colored text to visible/hidden.
0
 
TocacarCommented:
You can create a set of standard character styles (e.g., 'Italic', 'Underline', etc. which just applies the basic formatting you need for a chosen word, etc).  You can then apply this style to each word in the comment that needs to have this formatting.  Once this is in place, you can then apply a different style to the entire comment.  The individually styled words within the comment will retain their formatting through the character style, and your comment should have the overall style that you want.  

See sample Word doc attached.  The sentence is styled with 'Heading 3' but the words 'italic' and 'underlined' have their own character style assigned in order to maintain the desired formatting.  You can then hide the sentence using Format/Font/Hidden, and unhide it, and the formatting remains.

I hope this is useful.
Sample-style.doc
0
 
JohnRobinAllenAuthor Commented:
Many thanks for a simple and elegant solution to my problem.

    j.r.a.
0
Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

 
JohnRobinAllenAuthor Commented:
Unfortunately, further testing shows that the solution will not work with my stuff. It is logically perfect, but my problem is that while the character styles remain as defined if one applies a paragraph format style to them, if one applies a character style to a phrase, any other character styles to indicate underlining and the like disappear.
     My project deals with comments a professor inserts into a student's essay. The comments come from AutoCorrect entries and have a given style. The AutoCorrect entries retain all the formatting, which I currently apply through styles. To make the whole comment disappear or reappear as needed, I have to have the comment have a different character style than what is in the rest of the paragraph. VBA can then make the comments disappear by setting the ".hidden" of the style to "True".
    A possible way to accomplish my goal is to have each comment have a series of possible styles: normal, bold, underlined, double underlined, bold double underlined bold underlined, and so forth, and then change the ".Hidden" for each of those. That would require some heavy parsing of each comment and seems messy but not impossible and I do not think will take too long to make comments disappear and appear on the fly.
     Right now, when I want to hide a comment, since they are inserted with Track Changes on, I look for the next "change". I select it, accept the change, and apply a Comment style to it. When all the tracked changes have the Comment style applied, I specify that Comment.font.hidden should be True. The comments disappear.
     With the new method, I would still look for the next "change" and with a comment thus selected, I would, as usual, accept the change, then specify all the formatting character styles should be hidden. Whatever remains visible selected would be unformatted text. I would then apply the "Comment" style to that and turn Comment.hidden to true, and go on to the next comment.
     Then, to hide or show the professor's comment, I would have to go through all the formatting styles and turn each off (or on) as desired.
    Indeed, it might be possible to do that parsing in the AutoCorrect entries stored in memory.  
    I think that would work and would not take too much time, but a flaw in it is the danger that a professor might want to use the comment-underlined style for her own use, with disastrous consequences. I can take that risk.
     Anyway, I will try that method to solve the problem and will report back here if it works.
     Even though this question is closed, I would welcome any further suggestions on my proposed solution.

     j.r.
0
 
JohnRobinAllenAuthor Commented:
The method I described above will not work. I was happy to find out that making comments with AutoCorrect will keep styles that define underlining, double underlining, and bold in the comments (as well as the respective formatting).  I knew it would keep the formatting, but I did not know if it would keep the style governing that formatting.  It does, but to no avail

    My goal was then to hide the letters that had those style definitions and, with the formatted text hidden, to apply a "Comment normal" style to the whole of a comment. I hoped thus to protect the formatting that was hidden.

     The result: applying a character format to a selection extends even to hidden text. As soon as "Comment normal" is applied, all other character formatting disappears, the hidden characters become visible and the styles that governed the formatting are destroyed.
     
     At this point I am giving up on my goal to have formatted comments appear or be hidden at will. It is a big disappointment. My only consolation is that the program that changes inserted comments into a useful tool for students now runs a lot faster than it did before.

         j.r.a.

   
0
 
TocacarCommented:
Sorry it didn't work out.  Feel free to reclaim the points (if that's possible).
0
 
JohnRobinAllenAuthor Commented:
You deserved the points, for you provided a solution to the question, even if it did not work for my needs. I further learned more about VBA in the attempt. I also have the pleasure of seeing my program work very much faster than before.
  j.r.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now