Microsoft KB Archive/59513

Creating Custom OK and Cancel Buttons in Word for Windows PSS ID Number: Q59513 Article last modified on 07-14-1994

1.00 1.10 1.10a

WINDOWS

= SUMMARY =

Word version 1.x for Windows does not provide for generic text buttons in the same way that Excel does. To create a custom OK or Cancel button in Word for Windows (such as Next or Previous), add the text for the custom button in a successive line in the macro and give it the appropriate position parameters. For example, if the OK and Cancel buttons are specified in a dialog box description by the following macro code

OKButton 70, 285, 140, 21 CancelButton 280, 285, 140, 21

you can “rename” these buttons to Next and Quit respectively, by adding the following two text statements to the dialog box description:

OKButton 70, 285, 100, 21 CancelButton 280, 285, 100, 21 Text 80, 290, 80, 12, “Next” Text 290, 290, 80, 12, “Quit”

Word version 2.0 for Windows added the WordBasic PushButton statement for user dialog definitions. The PushButton statement allows you to add buttons to a user-defined dialog other than the standard OK and Cancel buttons.

= MORE INFORMATION =

Note that the x,y coordinates (the first two items in each parameter list) for the text are designed to place the text exactly on top of the OK and Cancel buttons. This does not change the normal functionality of the buttons, but creates the illusion of renaming the buttons. If the buttons do not display the new names after entering the text statements, check the x,y coordinates for accuracy and be sure they appear below the buttons in the dialog box description.

= REFERENCES =

“Using WordBasic” by WexTech Systems, Inc. and Microsoft Corporation,Microsoft Press, page 270.

Additional reference words: w4wmacro 1.00 1.10 1.10a 2.0 2.00 winword

=
================================================================

Copyright Microsoft Corporation 1994.