WD: How to Close an InputBox$() Dialog Box Using Keystrokes |
Q108629
This article discusses the keystrokes needed to close the dialog box displayed when using the InputBox command.
Q176476 OFF: Office Assistant Not Answering Visual Basic Questions
http://www.microsoft.com/partner/referral/For more information about the support options available from Microsoft, please see the following page on the World Wide Web:
http://support.microsoft.com/directory/overview.aspIf you want the user to type a single line of data and be able to press the ENTER key to close the dialog box, you can use a WordBasic user-defined dialog box instead of an InputBox, for example:
Sub MAIN
Begin Dialog UserDialog 320, 144, "Microsoft Word"
TextBox 10, 66, 292, 18, .TextBox1
OKButton 10, 6, 88, 21
CancelButton 10, 30, 88, 21
End Dialog
Dim dlg As UserDialog
n = Dialog(dlg)
If n = -1 then Insert dlg.textbox1
End Sub
If your dialog box needs to use a multiple line edit box, you can add a
shortcut key to the OK button using a WordBasic Dialog function. The OK
button shortcut key allows you to close the dialog box without using the
mouse (press ALT+O), for example:
Sub MAIN
Begin Dialog UserDialog 320, 144, "Microsoft Word", .dialogfunction
TextBox 10, 66, 292, 36, .TextBox1, 1
OKButton 10, 6, 88, 21
CancelButton 10, 30, 88, 21
End Dialog
Dim dlg As UserDialog
n = Dialog(dlg, - 1)
If n = - 1 Then Insert dlg.textbox1
End Sub
Function dialogfunction(ID$, Action, Suppval)
If action = 1 Then DlgText "OK", "&OK"
End Function Additional query words: InputBox$() input box paragraph enter newline
Keywords : kbmacro kbprg kbdta kbdtacode wordnt kbmacroexample macword98 winword ntword macword word6 word7 word95
Issue type : kbinfo
Technology : kbWordSearch kbWordWSearch kbWordMSearch
|
Last Reviewed: December 29, 2000 © 2001 Microsoft Corporation. All rights reserved. Terms of Use. |