
Tips.Net > WordTips Home > Macros > WordBasic Examples > Determining the Current Page Number with WordBasic
Summary: How to figure out, in a WordBasic macro, the page number where the selection pointer is located. (This tip works with Microsoft Word 6, and Word 95.)
As you are programming your macros, you may have a need to know the current page number on which the insertion point is located. This is easily obtained by using the following code line in your WordBasic macro:
CurPage = SelInfo(1)
When executed, CurPage is set to the value that would print if you asked Word to print a page number. CurPage represents a logical page number, not a physical page number. The difference is that logical page numbers take into account manual adjustments that may have been made to the document. For instance, if the user instructed Word to start counting pages at some value other than 1.
Tip #727 applies to Microsoft Word versions: 6 95
More Power! For some people, the prospect of creating Word macros can be scary. WordTips: The Macros can help you conquer your fears and you'll discover you're much more confident and productive as you make Word do exactly what you want. This is an invaluable source for learning macros. You are introduced to the topic in bite-sized chunks, pulled from past issues of WordTips. Learn at your own pace, exactly the way you want.
Check out WordTips: The Macros today!
Learn to use styles and you discover the real power behind Word. Fast, easy, consistent document formatting and updating is within your grasp. (more information...)
Ask a Word Question
Make a Comment
Beauty Tips
Bugs and Pests Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Organizing Tips
Pet Tips
Word2007 Tips
WordTips