Consulting

Results 1 to 3 of 3

Thread: [VBA] delete pages

  1. #1

    [VBA] delete pages

    Hi all,

    below is the code I found on net.
    I cannot find the explanation for the Name:="\page" part in help document.
    It it equivalent to highlighting the whole page?
    And, if I have to delete a series of ranges, e.g. from page 4 to 9
    is that I have to use a Step -1 for-loop where from 9 to 4 ?
    Thanks!

    Dim MyRange As Range
    Set MyRange = ActiveDocument.Range(0,0) 
    Set MyRange = MyRange.GoTo(What:=wdGoToPage, Name:="4")
    Set MyRange = MyRange.GoTo(What:=wdGoToBookmark,Name:="\page") 
    'you can then operate on the page without selecting it, e.g. 
    MyRange.Delete

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,726
    Location
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  3. #3
    very helpful information,Paul_Hossler !

Posting Permissions

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