What I really need the macro to do is apply certain formatting to the entire selection while maintaining the existing character styles in the selection. My question is: How can I overcome this bug/limitation and apply the character style ONLY within the selection/range? This behavior is the same using the actual GUI Find/Replace tool. If I create a test document that contains a few paragraphs and select a few words in one of the paragraphs, then run the macro, the "Emphasis" style is applied not only to the selection, but beyond the end of the selection to the end of the document. Replacement.Style = ActiveDocument.Styles("Emphasis") Style = ActiveDocument.Styles("Default Paragraph Font") Here's my vba code: Sub restyleSelection() It seemed that the Find/Replace feature would be a good place to start, but I think I've found a bug/limitation that prevents the macro from working as desired. I'm working on a Word 2007 template with a macro that will apply character styles to the selected text.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |