Formatting

B

B~O~B

I have a report that is generated daily, and I manually format the
report. Right now I have been using a Macro I record, but, it about
25 pages long. I know there has to be a easier way to the same
thing. What i want to do is take the 50 or so section and apply a
Header 3 format to them... I have a list of each section or is there
a way to Section ## to format (## = 01 and go to 48 and each section
tile start with)...

Can anyone help... I am using Word 2003... Have a basic
understating of Visual Basic...
 
G

Graham Mayor

What *exactly* do you want to format in each section? All the text? Some
heading or other? Something else?
What is it that you are starting with and what do you want to end up with?

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
B

B~O~B

I want the full Section Title (Section ## - XXXXXXXX) converted from
the output format to Header 3 formatting... The reason is so i can
generate a table of contents...
 
B

B~O~B

Here what i am using for the my report (copied the following for each
section and added each section title)... How can i streamline the
code..

Selection.Find.ClearFormatting
With Selection.Find
.Text = "SECTION 1 - These activities have been deleted from
revision."
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.Find.ClearFormatting
With Selection.Find
.Text = "SECTION 1 - These activities have been deleted from
revision."
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Style = ActiveDocument.Styles("Heading 3")
 
S

Suzanne S. Barnhill

Are you using multilevel outline numbering for the section numbers? If so,
you could link the Level 3 numbering to Heading 3.

If the paragraphs are not autonumbered, then you can use Replace to search
for the section numbers and apply the Heading 3 style: In the "Find what"
box, type "Section ^#" (without the quotation marks); leave the "Replace
with" box empty, but click More to expand the dialog, then click Format |
Style | Heading 3.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
http://word.mvps.org
 
G

Graham Mayor

Assuming that each section heading is in the body of the document then

Dim oPara As Paragraph
For Each oPara In ActiveDocument.Paragraphs
If Trim(oPara.Range.Words(1)) = "SECTION" Then
oPara.Style = "Heading 3"
End If
Next oPara


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - 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