Delete first line in section

P

Pete

I am sure this is easy ! but...

I would like to have a macro delete the first line of each section in a
document
My attempt below does not work - can anyone correct it for me

Thanks

pete



Dim s As Variant
For Each s In ActiveDocument.Sections
With s
.HomeKey Unit:=wdStory
.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
.Delete
End With
Next
 
D

Doug Robbins - Word MVP

Use:

Dim i As Long, myrange As Range
With ActiveDocument
For i = 1 To .Sections.Count
Set myrange = .Sections(i).Range
myrange.Collapse wdCollapseStart
myrange.Select
Selection.Bookmarks("\line").Range.Delete
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