Russ
Wed Aug 01 05:15:36 CDT 2007
"Is there a way to get the current heading level from a field?"
I originally thought you meant that some field was applying a Heading style
and you wanted to know how to find out what Heading style level it was
applying.
Now I see that you meant to create a field to determine the heading style.
> Oh, maybe you are asking for field code that will determine the previous
> level of the previous paragraph? There is no special field code for that, as
> far as I know. You would still have to use VBA to determine the Outline
> level and store that in a variable which could be used in a formula field or
> If..Then field.
>
>>
>> Msgbox selection.paragraphs(1).previous.style
>> If the previous paragraph is style Heading 4, then that is what you will see
>> in the message box.
>>
>> And like the link I gave you said:
>> Msgbox selection.paragraphs(1).previous.OutlineLevel
>> Will show the number 4 for Heading 4.
>>
>> What's in the field? ALT/F9 will toggle reveal field code or field results.
>> I not sure what you mean about no VBA code in the document. Usually you put
>> code in a template and open a new document with that template, you don't
>> want to mess with another user's Normal.dot setup.
>>> That's helpful, but it doesn't answer the question. I want to place a field
>>> in bodytext and be able to calculate something based on the Outline Level of
>>> the immediately preceding heading. I.e., if the text appears under Heading
>>> 1, then x=1; if it appears under a Heading 3, then x=3.
>>>
>>> So. (1) can you get outline level from a field (I want to avoid VBA code in
>>> this document); and (2) how do you find it for the immediately preceding
>>> heading when the field is in the body?
>>>
>>> Thanks.
>>> "Russ" wrote:
>>>
>>>> Read carefully about outline level in this link:
>>>> <
http://word.mvps.org/FAQs/Numbering/ListString.htm>
>>>>
>>>>> Is there a way to get the current heading level from a field?
>>>>>
>>>>> I can't use a StyleRef field because I don't know what style to look for
>>>>> (i.e. Heading 1, Heading 2 etc.)
>>>>>
>>>>> Thanks
>>>>>
>>>>> (I realize this is the VBA forum)
>>>>
>>>> --
>>>> Russ
>>>>
>>>> drsmN0SPAMikleAThotmailD0Tcom.INVALID
>>>>
>>>>
--
Russ
drsmN0SPAMikleAThotmailD0Tcom.INVALID