Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2006

Tip: Looking for answers? Try searching our database.

Delete first line in section

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Pete - 21 Jan 2006 14:24 GMT
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
Doug Robbins - Word MVP - 21 Jan 2006 17:57 GMT
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

Signature

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

>I am sure this is easy !    but...
>
[quoted text clipped - 14 lines]
>  End With
> Next
Pete - 21 Jan 2006 21:38 GMT
Doug  

Thank you - it works perfectly and I very much appreciate your time

Thanks

pete

> Use:
>
[quoted text clipped - 26 lines]
> >  End With
> > Next
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.