HELP - Can I customize headers with VB??

M

MaryC

Here's what I want to do:

I have a document broken up into Sections. Each Section is
a Chapter. Each Chapter is designated by a Level 1
Numbered List item (e.g., Chapter 2 Basic Facts,
where "Basic Facts" is the chapter TITLE). I want to put
the Chapter TITLE (that is, only the title, such as "Basic
Facts", not to include the word Chapter with the chapter
number)into the header, where it would dynamically change
to the correct chapter title for each Section.

I thought I might be able to do this with a text field in
the header but I don't know how to write the Visual Basic
script to make it grab the chapter title.

Can anyone help please??????????? Many thanks in advance!!
 
J

Jezebel

You don't need any VB for this. Use the Bullets and Numbering dialog to set
up your Level 1 Numbered List to include "Chapter" as part of the numbering
text (eg, the Number Format would be "Chapter 1."). Then in the header, use
a StyleRef field. This will display the text without the "Chapter n."
 
R

Rick Stebbins

You should be able to do this without VBA. If your
numbered list is associated with a style, such as Heading
1, you can use the STYLEREF field. It is capable of
retrieving the paragraph text without the paragraph
numbering.
 
M

MaryC

Thanks to you both. However, I'm afraid I'm a novice at
this. How do I use a "StyleRef" field to do this?
 
J

Jezebel

Go to Insert > Fields. Select 'Links and References' from the Categories
list. Select StyleRef from the FieldNames list. Click the Options button.
Click the Styles tab and select the your Level 1 Numbered List style. (You
might want to read the Switch options, but you probably don't need any of
them for this purpose.)

In your document you'll see the text of the nearest preceding paragraph of
the given style.

For working with fields, press Alt-F9. This toggles between displaying field
codes and field results. the field code will look like:

{ STYLEREF [stylename] }

The curly brackets are special characters, added by pressing ctrl-F9 (if you
want to insert fields by hand).
 
M

MaryC

Jezebel - Thanks a million!
-----Original Message-----
Go to Insert > Fields. Select 'Links and References' from the Categories
list. Select StyleRef from the FieldNames list. Click the Options button.
Click the Styles tab and select the your Level 1 Numbered List style. (You
might want to read the Switch options, but you probably don't need any of
them for this purpose.)

In your document you'll see the text of the nearest preceding paragraph of
the given style.

For working with fields, press Alt-F9. This toggles between displaying field
codes and field results. the field code will look like:

{ STYLEREF [stylename] }

The curly brackets are special characters, added by pressing ctrl-F9 (if you
want to insert fields by hand).




MaryC said:
Thanks to you both. However, I'm afraid I'm a novice at
this. How do I use a "StyleRef" field to do this?
Then
in the header, use Section
is field
in


.
 

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