Multiple Line Textboxes In Custom Dialog BoxesLast reviewed: July 30, 1997Article ID: Q94264 |
The information in this article applies to:
SUMMARYAlthough Word for Windows supports multiple-line edits in input boxes, such as the one produced by the WordBasic InputBox$ command, multiple-line edits are not available in WordBasic custom or user-defined dialog boxes. The WordBasic TextBox statement creates a text or edit box inside a user-defined dialog box. You can use the TextBox statement to type text in a dialog box; however, the TextBox statement is limited to a single line of text. Note: This restriction does not apply to later versions of Word for Windows. Note: This article assumes you have a working knowledge of Microsoft Visual Basic and the WordBasic macro programming language supplied with Word for Windows.
MORE INFORMATIONYou can use one of the following two methods to prompt for multiple lines of text. WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this macro code "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.
Method 1In a custom dialog box you can simulate a multiple-line textbox by creating multiple textboxes positioned immediately above or below one another. The following custom dialog box definition uses three separate TextBox statements to prompt for three lines of information:
Sub MAINBegin Dialog UserDialog 400, 168, "Microsoft Word" TextBox 126, 28, 252, 18, .TextBox1 TextBox 126, 53, 252, 18, .TextBox2 TextBox 126, 78, 252, 18, .TextBox3 OKButton 270, 106, 88, 21 CancelButton 270, 133, 88, 21 Text 43, 30, 48, 13, "Line 1" Text 43, 55, 48, 13, "Line 2" Text 43, 79, 48, 13, "Line 3"End Dialog Dim dlg As UserDialog n = Dialog(dlg) End SubNote: The WordBasic InputBox$ command and the Word for Windows FILLIN field accept more than a single line of text.
Method 2Microsoft Visual Basic supports the use of multiple-line textboxes, including scrollbars and other features. The following method describes how to create a simple Visual Basic program that contains a multi-line textbox, an OK button, and a Cancel button. In addition, a WordBasic macro is provided that shows how to use this application.
Case "ok" ' OK button pushed a$ = DDERequest$(chan, "multline") DDEExecute chan, "end" 'shutdown multiline form MsgBox a$, "Multiline Textbox Contents" Case "cancel" ' Cancel button pushed DDEExecute chan, "end" 'shutdown multiline formEnd Select End Sub REFERENCES"Using WordBasic," by WexTech Systems and Microsoft, pages 236 and 303
|
KBCategory: kbmacro
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |