copy first para of each section

F

FotoArt

hello everyone

i'm looping thru all the sections of a document.
How can I put the first paragraph of each section into a variable.
Or if I can put it into the header is better.
Hope someone can show me how to code both options.
thanx
ahmed
 
D

Doug Robbins - Word MVP

Dim i As Long
With ActiveDocument
For i = 1 To .Sections.Count
.Sections(i).Headers(wdHeaderFooterPrimary).Range =
..Paragraphs(1).Range
Next i
End With

Dim i As Long
With ActiveDocument
For i = 1 To .Sections.Count
.Variables("Sections" & i).Value = .Paragraphs(1).Range
Next i
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - 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