Microsoft KB Archive/106256: Difference between revisions

From BetaArchive Wiki
(importing KB archive)
 
m (Text replacement - """ to """)
 
Line 43: Line 43:
<pre class="CODESAMP">Sub MAIN
<pre class="CODESAMP">Sub MAIN


Begin Dialog UserDialog 320, 54, &quot;Microsoft Word&quot;
Begin Dialog UserDialog 320, 54, "Microsoft Word"


   TextBox 10, 22, 160, 18, .TextBox1
   TextBox 10, 22, 160, 18, .TextBox1
   PushButton 190, 18, 108, 21, &quot;Click here&quot;, .Push1
   PushButton 190, 18, 108, 21, "Click here", .Push1
   Text 10, 6, 44, 13, &quot;Name&quot;, .Text1
   Text 10, 6, 44, 13, "Name", .Text1


End Dialog
End Dialog
Line 57: Line 57:
Else
Else
   Name$ = dlg.textbox1
   Name$ = dlg.textbox1
   MsgBox &quot;hello &quot; + Name$
   MsgBox "hello " + Name$
End If
End If


Line 70: Line 70:
<pre class="CODESAMP">Sub MAIN
<pre class="CODESAMP">Sub MAIN


Begin Dialog UserDialog 200, 80, &quot;Microsoft Word&quot;
Begin Dialog UserDialog 200, 80, "Microsoft Word"
   OKButton 50, 25, 88, 21    '0
   OKButton 50, 25, 88, 21    '0
End Dialog
End Dialog

Latest revision as of 10:01, 20 July 2020

Close Command on Control Menu Unavailable in Custom Dialog Box

Q106256



The information in this article applies to:


  • Microsoft Word for Windows, versions 6.0, 6.0a, 6.0c
  • Microsoft Word for Windows, version 7.0





SYMPTOMS

In Word for Windows, the Close command on the Control menu is unavailable (dimmed) in user-defined dialog boxes that do not contain a Cancel button.



CAUSE

The Close command on the Control menu of a dialog box and the Cancel button in a dialog box serve the same purpose, namely to close the dialog box without making any changes. When a user-defined dialog box does not contain a Cancel button, Word assumes that you should not be able to close the dialog box without making some change.



WORKAROUND

Even though Close is grey on the application control menu you are able to use ALT+F4 to close the dialog box. The below code effectively disables ALT+F4

ALT+F4 will return a 0 value as though Cancel was pressed.

Sub MAIN

Begin Dialog UserDialog 320, 54, "Microsoft Word"

   TextBox 10, 22, 160, 18, .TextBox1
   PushButton 190, 18, 108, 21, "Click here", .Push1
   Text 10, 6, 44, 13, "Name", .Text1

End Dialog
Dim dlg As UserDialog
again:
Choice = Dialog(dlg)
If Choice = 0 Then
Goto again
Else
   Name$ = dlg.textbox1
   MsgBox "hello " + Name$
End If

End Sub 



MORE INFORMATION

The following WordBasic macro is an example of a user-defined dialog box in which the Close command on the Control menu is unavailable:

Sub MAIN

Begin Dialog UserDialog 200, 80, "Microsoft Word"
   OKButton 50, 25, 88, 21     '0
End Dialog
Dim dlg As UserDialog
Dialog dlg

End Sub 

Kbcategory: kbusage kbmacro

Additional query words: 6.0 grey gray greyed grayed word6 7.0 word95 word7 winword

Keywords :
Issue type :
Technology :


Last Reviewed: November 4, 2000
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.