If the style that you want to apply is a paragraph+character type of style, you could create a new paragraph-only style based on it. Applying that to the paragraph shouldn't change the character formatting.
Main Topics
Browse All TopicsUsing VBA in Word, I need to apply a new style to a paragraph of text, some of which is in italics. That kills the italics.
In detail, I use the command
ActiveDocument.Paragraphs(
Where Different Style is the new paragraph style.
Unfortunately that removes all character formatting in the paragraph.
To overcome that at least for italics, I
1. Find two character that I call ItalicsStart and ItalicsEnd, characters are not already in the document
2. I put the first character at the start of each italicized section and put the second character at the end of each such section.
3. I reset the style of the paragraph with the command shown above
4. I then reitalicize the text:
a. I search for the first ItalicsStart character.
b. I delete the character.
c. I turn on extend and search for the ItalicsEnd character.
d. I italicize the selected text.
e. I collapse to the end and delete the ItalicsEnd character.
f. I repeat the above steps until there are no more places where I need to italicize the text.
Those steps do not handle anything in bold or underlined but at least they work for italics, and it hardly seems worth the trouble to do the same for bold or underlined text. Is there not something else I could do to keep the character formatting as I change the paragraph style?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
In response to JOrzech: It does not seem to matter whether my cursor is in the middle of the paragraph or at the start. In VBA or in simply editing the text, when I press Shift + Ctrl + "s" to display the "Apply Styles" window and there choose another style, the italics and all other character formatting disappear to take on the default font style of the paragraph. (I use Word 2007; perhaps that is the problem.)
In response to GrahamSkan, I am not yet familiar with the paragraph+character style, but that might be the solution. I'll Google it and get back to you on EE a.s.a.p.
--j.r.a.
Response to Graham Skan: I searched MS Word help, Herb Tyson's Word 2007 Bible, and I Googled "vba word linked styles". Nothing helped with my particular problem.
Since then, I found a solution:
a. Specify a new character style named "Italics" or whatever name you want. Define its formatting as italics.
b. Instead of simply selecting text and pressing Ctrl + I to italicize the selected text, apply the new style to the selection. You can have VBA do that too, as long as you have previously created the character style.
c. When you then apply a new paragraph style to the paragraph, it retains the character styles in the paragraph.
The only problem I see with that solution is how can one make a new character style in MS Word 2007? It has a bug (a feature?) that will not let you make a new character style in the Apply Styles window where you normally make new paragraph styles. (The character style choice is deactivated.) Instead, to make a new character style, you have to go to the Home tab and in the "Styles" section, you click on the little button in the lower right corner.
That opens the "Styles" window at the bottom of which are three buttons. The leftmost of those three buttons is the "New Style" button. If you click on that, you see the same dialog box you see in the Apply Styles window, but here the character style choice is no longer deactivated.
Thanks to you and JOrzech for your help. Without your comments, I probably would not have found the solution.
--j.r.a.
In the solution I found for my problem, I should have added that one should distinguish between direct formatting of characters and stylistic formatting of characters. With direct formatting, one selects the characters to change and then clicks on the appropriate buttons or shortcut keys, or one presses Ctrl + D to go to the Font dialog box and apply whatever formatting you want directly to the selected letters.
With stylistic formatting, one still selects the characters to change, but then one applies a named character style to those characters. You can then change the formatting of the selected characters by modifying the particular style.
I use direct formatting for almost all of my character formatting, and when I then have VBA apply a different paragraph formatting, or when I apply the new paragraph formatting manually, Word destroys my direct formatting. I therefore write a macro to change all my direct formatting to apply an appropriate style to those characters before I apply any new paragraph style.
With that, the character formatting through styles survives the change in paragraph formatting.
I thank all of you whose help let me find a solution and throw away the kludge sixty lines of code that I described in my first posting.
j.r.a.
Business Accounts
Answer for Membership
by: JOrzechPosted on 2009-11-06 at 06:36:28ID: 25759408
I don't understand why the text in italics is being reformatted, even if you apply a paragraph style that is not set to italics. Are you by chance selecting the paragraph? If your cursor is at the beginning of the paragraph, the font attributes existing should not change when you apply a paragraph style.
Could you clarify?