WD: WordBasic Examples: GotoNext/GotoPreviousLast reviewed: February 2, 1998Article ID: Q105862 |
The information in this article applies to:
SUMMARYThis article contains a sample macro that demonstrates the use of the following WordBasic statements or functions:
GoToNextAnnotation GoToPreviousAnnotation GoToNextEndnote GoToPreviousEndnote GoToNextFootnote GoToPreviousFootnote GoToNextPage GoToPreviousPage GoToNextSection GoToPreviousSection GoToNextSubdocument GoToPreviousSubdocumentThis article supplements the information in online Help. To open this Help topic in Word for Windows, click Contents on the Help menu and then choose the "Programming with Microsoft Word" topic. In Word for the Macintosh, click the Help icon and select Microsoft Word Help. Choose the "Programming with Microsoft Word" topic.
MORE INFORMATIONThe commands listed in the "Summary" section of this article are single line commands. They have no arguments and are used to move to specified parts of the document.
ExampleThe macro below could be used to go to different parts of the active document. In all instances the GoToNextCommand could be replaced with GoToPreviousCommand. If the item selected to go to does not exist, the insertion point will not move.
Sub MAIN Begin Dialog UserDialog 225, 146, "Goto" OKButton 36, 118, 88, 21 CancelButton 129, 119, 88, 21 OptionGroup .HelpChoice OptionButton 12, 6, 180, 16, "Next Annotation", .OptionButton1 OptionButton 12, 23, 180, 16, "Next Endnote", .OptionButton2 OptionButton 12, 40, 180, 16, "Next Footnote", .OptionButton3 OptionButton 12, 57, 180, 16, "Next Page", .OptionButton4 OptionButton 12, 74, 127, 16, "Next Section", .OptionButton5 OptionButton 12, 91, 172, 16, "Next Subdocument", .OptionButton6 End Dialog Dim dlg As UserDialog GetCurValues dlg n = Dialog(dlg) If n = 0 Then Goto bye Select Case dlg.HelpChoice Case 0 GoToNextAnnotation ' Any of the above commands would Case 1 ' work inserted here. GoToNextEndnote Case 2 GoToNextFootnote Case 3 GoToNextPage Case 4 GoToNextSection Case 5 GoToNextSubdocument End Select bye: End Sub |
Additional query words:
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |