Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    May 2002
    Location
    Toronto, Ontario, Canada
    Posts
    314
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Using VBA to delete 1st line on each page... (2000 SP-3)

    Hello everyone...

    This is my first time trying to use VBA automation with Word... I have a old document that is over 400 pages... I want to write code to do the following:

    Go to top line of the first page of the document
    Select and/or delete the top line of the page
    Delete one more space (to move up the old second line to the first)
    Move to the next page
    Continue this process (looping) until the end of the document

    I'm so completely unfamiliar with Word's objects and collections and I've tried searching VBA help but I'm not finding any answers...
    It seems like such a simple thing to do... It must be possible...
    Any help would be appreciated...

    <img src=/S/thankyou.gif border=0 alt=thankyou width=40 height=15>

  2. #2
    3 Star Lounger
    Join Date
    Apr 2004
    Location
    Boston, Massachusetts, USA
    Posts
    389
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Using VBA to delete 1st line on each page... (2000 SP-3)

    Hi Alexya,

    This will be tricky. There's no "page" object in Word VBA, because of how pagination is controlled (it involves the printer driver). The same document on two different machines might have slightly different pagination.

    In addition, as you move through a 400-page document, deleting items, the text will move "up", and what was once at the top of a page might be at the bottom of the previous page.

    Are there manual page breaks in the document? Could you describe more specifically the reason you're deleting the first line of every page? Even more helpful would be a few sample pages (replace with dummy text if the information is sensitive).

Posting Permissions

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