Word macro to convert heading styles

J

Joe Soap

Hi all,

I'm new here so I am not sure I am posting this to the correct
sub-forum. :confused: I am looking for Word macro that can work through
a document, look at the field code of each paragraph and change its
paragraph style to a "heading" style based on a given condition.

BACKGROUND:[/B] OUR AUTHORING SYSTEM AT WORK IS DATABASE-ORIENTED - IT
USES WORD 2000 OR XP AS THE WRITING TOOL. WE WRITE SMALL CHUNKS (CALLED
\"INFOTOPICS\") THAT REPRESENT SUB-SECTIONS IN A CHAPTER. AS DATABASE
OBJECTS THESE SUB-SECTIONS HAVE NO HIERARCHICAL LEVEL METADATA. IT IS
ONLY WHEN I CREATE A \"STRUCTURE\" AND START PLUGGING IN WRITTEN
INFOTOPICS (OBJECTS FROM THE DATABASE), DO THE INFOTOPICS RECEIVE SOME
FORM A RELATIONAL HIERARCHY.

*PROBLEM:* THE TITLE OF EACH INFOTOPIC I WRITE MUST ALWAYS START AS A
\"HEADING 2\" PARAGRAPH STYLE AND THEN THE SUB-HEADINGS (CALLED
\"KEYBLOCKS\") ARE \"HEADING 3\". IN OTHER WORDS, THERE IS NO SUCH
THING AS \"HEADING 4\" ONWARDS WHEN WRITING. THIS MEANS THAT WHEN I
EXPORT A BOOK (IN WORD FORMAT) I GET A SERIES OF TOPICS ONE AFTER
ANOTHER THAT ARE ALL HEADING 2'S!!! THE HEADINGS ARE NOT VISUALLY
NUMBERED, WHICH MEANS THAT THERE IS NO WAY OF TELLING HOW THE TOPICS
ARE HIERARCHICALLY RELATED TO ONE ANOTHER! I HOPE THIS IS CLEAR? THE
TOC OF THE WORD DOC HOWEVER DOES SHOW ME THE HIERARCHY OF THE TOPICS
BECAUSE EMBEDDED IN EACH TOPIC'S TITLE IS THE \"/I <X>\" FIELD CODE
(WHERE \"X\" IS A LEVEL NUMBER).

*QUESTION:* I NEED A MACRO THAT GOES THROUGH THE DOCUMENT FROM START TO
FINISH, READS EACH \"HEADING 2\" LINE, LOOKS AT WHAT \"X\" VALUE IS
ASSIGNED TO THE \"/L\" FIELD CODE, AND THEN CONVERTS ITS HEADING STYLE
TO THE CORRESPONDING NUMBER. FOR EXAMPLE: IF A HEADING 2 LINE READS:
*\"REAL-TIME COLLABORATION\" {TC \"REAL-TIME COLLABORATION\" \L 1 \*
MERGEFORMAT}\"
then the paragraph style assigned to that line is "Heading 1" because
\l = 1*.

Does anyone have any ideas? I am not a programmer, but at face value it
doesn't at all seem complicated to do as a macro. I would be most
grateful for any assistance! :D
 
D

Doug Robbins - Word MVP - DELETE UPPERCASE CHARACT

Repost your question without using ALL CAPS and I will try and read it.

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top