PRB: WordBasic's CHR$ Function Produces Error in Visual FoxProLast reviewed: October 29, 1996Article ID: Q156939 |
The information in this article applies to:
SYMPTOMSVisual FoxPro produces one of the following three errors when using the CHR$(11) function to place a newline character in a Microsoft Word 7.0a for Windows 95 document:
OLE IDispatch exception code 5004 from Microsoft Word. Too many or too few arguments. -or- OLE error code 0x80002006 Unknown name. -or- Syntax Error.The error varies depending upon the version of Visual FoxPro being run. However, these commands function properly in Visual Basic 4.0.
CAUSEThe dollar sign ($) character is an operator in Visual FoxPro. Therefore, FoxPro expects the dollar sign character to carry out Xbase functionality and not a WordBasic function.
WORKAROUNDUse FoxPro's CHR() function to insert the value into WordBasic. For example, replace one of the following lines:
X.Insert(X.CHR$(11)) -or- X.Insert(X.Object.CHR$(11))with the following line:
X.Insert(CHR(11)) STATUSThis behavior is by design.
MORE INFORMATIONThe WordBasic function Chr$(11) should place a newline character in a Word 95 document. However, when FoxPro sees the dollar sign character, it looks for the two arguments normally required for this function. Usually, Visual FoxPro interprets a dollar sign character to mean search for a value within a string or field. Visual FoxPro does not recognize the Word 95 usage of this character.
Steps to Reproduce Behavior
|
KBCategory: kbinterop kbprb
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |