WD: Inserting Macro Variable Contents into a Document WindowLast reviewed: February 2, 1998Article ID: Q86079 |
The information in this article applies to:
SUMMARYThis article includes macro examples for inserting text into a Microsoft Word for Windows document using WordBasic commands.
MORE INFORMATIONThe following example WordBasic macro can be used to insert the contents of the Name$ variable at the insertion position in the active document window:
Sub MAIN ' A name is assigned to Name$ variable Name$ = "John Doe" ' Contents of Name$ variable inserted into document. Insert Name$ End SubThe following sample macro can be used to insert the contents of the Name$ variable as literal text, using the QUOTE field:
Sub MAIN ' A name is assigned to Name$ variable Name$ = "John Doe" InsertField "quote " + Chr$(34) + Name$ + Chr$(34) End SubThe above macro produces the following field syntax:
{quote "John Doe"} Field result = John DoeThe result of a QUOTE field is the text typed between the quotation marks. The Chr$(34) command above is the quotation mark character ("). NOTE: Microsoft provides macros "as is" without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. For information about how to do this in Word 97 and later, please see the following articles in the Microsoft Knowledge Base:
ARTICLE-ID: Q161407 TITLE : WD97: VB Macro Examples to Insert Text into a Document REFERENCES"Using WordBasic," by WexTech Systems and Microsoft, pages 236, 239
|
Additional query words: winword2 insert text word6 word7 winword word95
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |