WD: Closing an InputBox$() Dialog Using KeystrokesLast reviewed: March 13, 1998Article ID: Q108629 |
The information in this article applies to:
SUMMARYThis article discusses the keystrokes needed to close the dialog displayed when using the InputBox command.
MORE INFORMATION
Word 97 for Windows or Word 98 Macintosh EditionThe Visual Basic for Applications InputBox command accepts only one line of text. Pressing ENTER (RETURN in Word for the Macintosh) closes the InputBox dialog. For more information about InputBox, from the Visual Basic for Applications Editor, click the Office Assistant, type "InputBox," click Search, and then click to view "InputBox." NOTE: If the Assistant is hidden, click the Office Assistant button on the Standard toolbar. If the Assistant is not able to answer your query, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q176476 TITLE : OFF: Office Assistant Not Answering Visual Basic Questions Word 6.x, 7.xIn Word 6.x-7.x, you can enter a new line by pressing ENTER (RETURN in Word for the Macintosh), but as a result, this key will not click the OK button. To close an InputBox$() in Word 6.x-7.x, you must press the TAB key and then press ENTER. The TAB key moves the focus to the OK button so that when you press the ENTER key, the dialog box is closed. Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:
http://www.microsoft.com/supportnet/refguide/If 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 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 SubIf 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 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 Word 2.xIn Word 2.x, you pressed SHIFT+ENTER to enter a new line in an Inputbox$. Pressing ENTER closes the Inputbox dialog.
|
Additional query words: InputBox$() input box paragraph enter newline
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |