word document - how to create custom section headers?

Anonymous
2017-08-17T16:37:36+00:00

I have a Word 2016 document with 6 sections in it. Each section contains 3 tables. It's possible for the tables to span more than one page. When they do, I'd like to repeat the section header at the top of the second page, with " (continued)" tacked onto the end of the header. I looked at "fields" for this, but I don't see that level of customization. Can anyone suggest what Word features I should use to create this effect?

***Post moved by the moderator to the appropriate forum category.***

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
Answer accepted by question author
Doug Robbins - MVP - Office Apps and Services 323.6K Reputation points MVP Volunteer Moderator
2017-08-21T23:43:35+00:00

Try using a STYLEREF field.

Was this answer helpful?

2 people found this answer helpful.
0 comments No comments

43 additional answers

Sort by: Most helpful
  1. Charles Kenyon 171.1K Reputation points Volunteer Moderator
    2017-09-21T12:18:10+00:00

    ***

    Is this the same as Collapsed sections?

    ***

    Hidden Sections aren't the same as Collapsed. I'm using the command

    wrdDoc.Section(i).Range.Font.Hidden = True

    ***

    If a StyleRef Field refers to text that has been marked as hidden, it will show as blank.

    StyleRef field does not work with hidden text

    Useful StyleRef tricks by Suzanne Barnhill (Figure 7)

    In other words, if following the rules for which text is found by a StyleRef field, Word encounters text in the document that has been marked as hidden, it uses that text, but does not display it. It does not find the next instance of the style that is unhidden.

    I believe that is the source of your problem.

    Note that hidden text is not gone. It is there.

    I generally have Word set to display hidden text. You have no control over whether or not the user displays hidden text.

    I would urge you to explore Peter's work. I do not know if it will do what you want.

    Was this answer helpful?

    0 comments No comments
  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  3. Anonymous
    2017-09-21T08:29:23+00:00

    A little late, but instead of using STYLEREF fields, you might be able to use the general approach I describe in the sample document at https://goo.gl/2vsL8E

    Was this answer helpful?

    0 comments No comments
  4. Stefan Blom 353.6K Reputation points MVP Volunteer Moderator
    2017-09-20T18:47:18+00:00

    Note that you don't need sections to format a text range as hidden. For example, if you enclose a range in a bookmark, you can use similar code to hide the range defined by the bookmark:

    ActiveDocument.Bookmarks("BookmarkName").Range.Font.Hidden = True

    The best approach will, of course, depend on what you are trying to accomplish in the end.

    Was this answer helpful?

    0 comments No comments