WD: Toggling or Setting Word Dialog Box Check Boxes

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
  • Microsoft 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 : kbmacro wordnt kbmacroexample winword ntword macword word6 winword2 word7 word95
Version : MACINTOSH:6.0,6.0.1; 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; winnt:6.0
Platform : MACINTOSH WINDOWS winnt
Issue type : kbhowto


Last Reviewed: December 28, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.