WD: Toggling or Setting Word Dialog Box Check Boxes

Last reviewed: February 2, 1998
Article ID: Q93035
The information in this article applies to:
  • Microsoft Word for Windows, versions 1.0, 1.1, 1.1a, 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

SUMMARY

In a Microsoft Word dialog box, a selected check box has a value of 1 and a clear check box has a value of 0. To reverse or toggle a check box value, subtract 1 from the current value and use the Abs() function to produce the absolute value of the result.

The following example toggles the Background Pagination option in the ToolsOptionsGeneral dialog box:

   Sub MAIN
      Dim dlg As ToolsOptionsGeneral
      GetCurValues dlg
      dlg.Pagination = Abs(dlg.Pagination - 1)
      ToolsOptionsGeneral dlg
   End Sub

In the above example, dlg.Pagination relates to the Pagination parameter for the ToolsOptionsGeneral macro command:

   ToolsOptionsGeneral [.Pagination = number,]

The Dim statement is used to declare a dialog box record variable in which the values of a Word dialog box can be stored. The GetCurValues statement stores the current values for the previously dimensioned dialog box in the specified dialog box record. The above example uses "dlg" as the name of the dialog record.

MORE INFORMATION

To set a value in a Word dialog box, set the dialog box record variable (that is, the dlg.parameter) to 1 or 0:

   dlg.SummaryPrompt = 0  'turns option off
   dlg.SummaryPrompt = 1  'turns option on

The following macro example clears the Prompt For Summary Info check box in the ToolsOptionsSave dialog box:

   Sub MAIN
      Dim dlg As ToolsOptionsSave
      GetCurValues dlg
      dlg.SummaryPrompt = 0
      ToolsOptionsSave dlg
   End Sub

REFERENCES

"Using WordBasic," by WexTech Systems and Microsoft, pages 174 and 228.


Additional query words: Dim dlg GetCurValues deselect gray out enable
disable grey unavailable Reverse Abs Toggle
Keywords : kbmacroexample macword ntword winword winword2 word6 word7 word95 wordnt kbmacro
Version : WINDOWS:1.0,1.1,1.1a,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 Win95 WINDOWS winnt
Issue type : kbhowto


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.