Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.pagelayout
Mike
 
Posts: n/a
Default TOC helper - replace hidden paragraph with style separator

I work at a help desk with a large number of Word users and occassionally
run into the problem where users either are not familiar with using the
style separator (to assist in creating run-in headings so that only the
heading, not the body text, shows up in the TOC) or are older documents that
used hidden paragraph marks. Since multiple people can work on a document,
we sometimes end up with documents that partly use style separators and
partly use hidden paragraph marks - VERY confusing. So I created the
following script to replace the hidden paragraph mark with the style
separator (for Word 2002 & above).

Although this code has been working well for the past several days, we are
still testing it. If you would like to use it, PLEASE PLEASE PLEASE save
the document you are going to try it on first. Although I cannot imagine
why it would cause any problems, it is designed to replace items in the
document, so there is always the chance I may have overlooked something.

Mike

Sub HiddenParaToStyleSep()
Selection.HomeKey Unit:=wdStory
' Find hidden paragraph
With Selection.Find
.ClearFormatting
.Text = "^p"
.Font.Hidden = True
.Forward = True
While .Execute
' If hidden paragraph is Style Separator, do not replace
If Selection.Paragraphs(1).IsStyleSeparator = False Then
' Replace hidden paragraph with auto color, unhide
With Selection.Font
.Hidden = False
.Color = wdColorAutomatic
End With
' Insert style separator
Selection.InsertStyleSeparator
End If
Wend
End With
End Sub


Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hidden text won't stick Gary Burton Formatting Long Documents 10 February 17th 06 02:03 AM
Table Format Style vs. Table Text Style WebColin Page Layout 11 December 1st 05 11:29 PM
Outline level auto-select custom style Stuart Summerville Formatting Long Documents 12 May 24th 05 08:32 PM
How can I replace a paragraph with another paragraph using "find . tml0701 Microsoft Word Help 1 January 5th 05 01:43 PM
Can a style become font-neutral? F A L Page Layout 5 December 3rd 04 01:12 PM


All times are GMT +1. The time now is 06:47 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"