Delete contents of section, but leave section in place

B

Bob

I have a bookmark at the very beginning of a section. I
want to go to that bookmark and then delete the contents
of the section but leave the section and bookmark there.

I've done a 'goto the bookmark' and then expanded the
selection by

Selection.Expand wdSection
Selection.Delete

but this selects the last paragraph mark and therefore
the section break.
 
D

Doug Robbins - Word MVP

Use

Dim myrange As Range
Set myrange =
ActiveDocument.Bookmarks("BookmarkName").Range.Sections(1).Range
myrange.End = myrange.End - 1
myrange.Text = ""
ActiveDocument.Bookmarks.Add "BookmarkName", myrange


--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
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