WD: Macros to Move Insertion Point to Top of Current Page

Last reviewed: February 2, 1998
Article ID: Q94977
The information in this article applies to:
  • Microsoft Word for Windows, versions 2.0, 2.0a, 2.0a-CD, 2.0b, 2.0c, 6.0, 6.0a, 6.0c
  • Microsoft Word for Windows NT, version 6.0
  • Microsoft Word for Windows 95, versions 7.0, 7.0a
  • Word for the Macintosh, versions 6.0, 6.0.1, 6.0.1a

SUMMARY

Word does not provide a feature to move the insertion point to the top of the current page. However, you can achieve this result by using a short WordBasic macro.

MORE INFORMATION

The WordBasic programming language provides the following features you can use to create a macro that moves the insertion point to the top of the current page. For the WordBasic commands appropriate to your version of Word, see the section under the heading that describes your version of Word.

For information about how to do this in Word 97, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q159973
   TITLE     : Word 97: Macro to Move Insertion Point to Top of Current
               Page

WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this macro code "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

Word 7.x for Windows 95, and Word 6.x (all platforms)

In Word 6.x and Word 7.x for Windows 95, you can use the commands "GoToPreviousPage," or "GoToNextPage" to move to the top of a page. The following table lists the the keyboard shortcuts and their eqivalent WordBasic commands.

   WordBasic Command                Keystroke
   -------------------------------------------------

   GoToNextPage                     CTRL+ALT+PgDown
   GoToPreviousPage                 CTRL+ALT+PgUp

The following macro example moves the focus point to the next page in a document:

   Sub Main
      GoToNextPage
   End Sub

Word 2.x

There are two commands in WordBasic for Word 2.x can be used to move to a new page in a document:

  • SelInfo(): WordBasic function that determines the page number where the insertion point is located.
  • EditGoto: WordBasic function that can position the insertion point at the top of a page, given its page number.

The following macro, named TopOfPage, uses the above functions to move the insertion point to the top of the current page:

   Sub Main
      EditGoto Str$(SelInfo(1))
   End Sub

NOTES: You can modify the second line in the above macro to move the insertion point to other locations, as described below:

   Macro Command         Moves Insertion Point To
   ----------------------------------------------

   EditGoTo "PL1"        Top of current page
   EditGoTo "-L1"        Top of previous page
   EditGoTo "+L1"        Top of next page

You can add these macros to your Normal template, where they are available globally. For information on assigning this macro to a shortcut key combination, see the "Customizing Shortcut Key Assignments" section on page 721 of the "Microsoft Word for Windows User's Guide."

REFERENCES

"Microsoft Word for Windows User's Guide," version 2.0, pages 721, 765, 784-786


Additional query words: macro
Keywords : kbmacroexample macword ntword winword word6 word7 word95 word97 wordnt kbmacro
Version : WINDOWS:2.0,2.0a,2.0a-CD,2.0b,2.0c,6.0,6.0a,6.0c,7.0,7.0a; MACINTOSH:6.0,6.0.1,6.0.1a
Platform : MACINTOSH WINDOWS
Issue type : kbhowto kbinfo


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 2, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.