

Execute Wrap:=wdFindContinue, Format:=True, Replace:=wdReplaceOne You could also change this to Replace:=wdReplaceAll to catch Based on your requirements, this only replaces the ' beginning of the text will NOT work that will apply your style to the previous ' that fall at the end of a paragraph, which is likely the case as your headings sit on Putting "^p" at the end of the string limits it to text strings ' This searches the entire document (not including foot/endnotes, headers, or footers) Set head4 = ActiveDocument.Styles("Heading 4") Set head3 = ActiveDocument.Styles("Heading 3") Set head2 = ActiveDocument.Styles("Heading 2")

Set head1 = ActiveDocument.Styles("Heading 1") ' but be aware of that if you want to expand upon this for other uses. That's probably not a concern with built-in styles,
#CHANGING HEADING STYLES IN WORD 2013 CODE#
' This code does *NOT* protect against the possibility that these styles don't ' you to easily change, for instance, "Heading 4" to "My Personal Heading 4" ' Using variables here just simplifies the typing further on, and allows Sub QOS_Headings()ĭim head1 As Style, head2 As Style, head3 As Style, head4 As Style If you're still seeing only Heading 2 applied after you run this, it might be necessary to include a portion of the text of your document in your question to clarify exactly what it looks like. That's not perfect, but it should be closer to what you're looking for. This searches for your text followed by a paragraph break. In order to limit your searches to text on its own line, I've added the special "^p" find sequence. This just takes your searches and makes them actual search and replaces so that changes are only made when the text is found. For your purposes, and to make this as clear as possible, I haven't done that. Or you could put your text strings into an array that you loop through to keep the actual code to a minimum. You could use wildcard searches to minimize the actual number of searches required. So, there are a few ways to make your code more expandable or reusable. Selection.Style = ActiveDocument.Styles("Heading 4") Selection.Style = ActiveDocument.Styles("Heading 3") Selection.Style = ActiveDocument.Styles("Heading 2") Selection.Style = ActiveDocument.Styles("Heading 1") ' Converts section headings in eCTD to usable navigation headings in Word. The code is listed below: Sub QOS_Headings()_ Any help in this area would be appreciated very much. When I typed in the code, I got no errors, but the Headings are formatted with the "Heading 2" style only, even though multiple heading styles are used. This will aid in navigating through the document.

I am looking for a way to run a macro that would reformat the numeric headings along with the text beside it. The numbers are specific and essentially represent the content of the material below the heading and thus are not going to change. What precedes the text in the headings are numbers. I am trying to create specific headings in a document that does not have any or has different heading styles assigned. I am very new to programming, so forgive my ignorance.
