The information in this article applies to:
SUMMARYWhen you use Microsoft WordBasic functions in Visual Basic, keywords that return strings--that is, keywords that end in a dollar sign ($)-- must be enclosed in square brackets or an error message will occur. Example 1The following WordBasic instruction returns the current date:
In Visual Basic, the same instruction is specified as follows:
The following Visual Basic example uses Word's Date$() function to
post the current date in a message box:
If you omit the square brackets that surround "Date$", Visual Basic
will post the following error message:
Example 2The following WordBasic instruction shows the GetBookmark$() function as it might appear in a WordBasic macro:
In Visual Basic, the same instruction would be specified as follows:
The following Visual Basic procedure opens the Word document TEST.DOC,
and then uses the WordBasic GetBookmark$() function to return the
text of the "Address" bookmark in a message box:
More InformationVisual Basic 4.x does not require the square backets "[ ]". They can however be used, as with VB3, without modification.Additional query words: 6.0 ole automation word basic word6 word7 7.0 word95 object visual dollar sign brackets function return winword
Keywords : kbole |
Last Reviewed: December 23, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |