Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Oct 2007
    Posts
    172
    Thanks
    0
    Thanked 2 Times in 1 Post

    Deleting Things (2003)

    Hi,

    I would like to give the users of a template the option of deleting a couple of pages that usually aren't needed, when a new document is created based on that template. I could do it in a nasty way that makes all kinds of assumptions about where exactly in the document these pages are, what styles they are etc (e.g. search for the first text of x style and select it, expand for 2 paragraphs, then delete). I would prefer to do it in a more independent way, such as deleting between two defined marks e.g. using hidden bookmarks to mark the beginning of the bit to delete and the end.

    Whilst I can go to the named bookmark for the beginning (Using Selection.Goto) I can't find out to expand the selection to the 'end' bookmark.

    Any ideas on how I could go about this? I'm trying to write it in a way that is insulated from any minor style / page ordering changes etc. to the template in the future.

    cheers

  2. #2
    2 Star Lounger
    Join Date
    Oct 2007
    Posts
    172
    Thanks
    0
    Thanked 2 Times in 1 Post

    Re: Deleting Things (2003)

    With ActiveDocument
    .Range(.Bookmarks("Name1").Range.End, .Bookmarks("Name2").Range.Start).Delete
    End With

    seems to be the answer.. should've researched a bit more before posting.. apologies!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •