Microsoft KB Archive/111872: Difference between revisions
(importing KB archive) |
m (Text replacement - """ to """) |
||
Line 19: | Line 19: | ||
<ul> | <ul> | ||
<li><p>Add a single quotation mark to the beginning of the field; for example:</p> | <li><p>Add a single quotation mark to the beginning of the field; for example:</p> | ||
<pre> =DDEPOKE(mchan, | <pre> =DDEPOKE(mchan,"R1C1","'"+fld1)</pre> | ||
<p>NOTE: This method will transfer the FLD1 field as character but will add an additional single quotation mark toward the beginning of the field. This extra quotation mark can be removed manually or with the help of a Microsoft Excel macro.</p> | <p>NOTE: This method will transfer the FLD1 field as character but will add an additional single quotation mark toward the beginning of the field. This extra quotation mark can be removed manually or with the help of a Microsoft Excel macro.</p> | ||
<p>-or-</p></li> | <p>-or-</p></li> | ||
<li><p>Add '= | <li><p>Add '="' to the beginning of the field and '"' to the end; for example:</p> | ||
<pre> =DDEPOKE(CHAN, | <pre> =DDEPOKE(CHAN,"R1C1",'="'+fld1+'"')</pre> | ||
<p>With this method, Microsoft Excel will treat the contents of FLD1 as an expression.</p></li></ul> | <p>With this method, Microsoft Excel will treat the contents of FLD1 as an expression.</p></li></ul> | ||
Line 38: | Line 38: | ||
CREATE TABLE xddetst.dbf (fld1 C(8)) | CREATE TABLE xddetst.dbf (fld1 C(8)) | ||
APPEND BLANK | APPEND BLANK | ||
REPLACE fld1 WITH | REPLACE fld1 WITH "12345678" | ||
mchan = DDEINITIATE( | mchan = DDEINITIATE("EXCEL","SHEET1") | ||
=DDEPOKE(mchan, | =DDEPOKE(mchan,"R1C1",fld1) | ||
With the above DDEPOKE() command FoxPro will send the FLD1 field | With the above DDEPOKE() command FoxPro will send the FLD1 field |
Latest revision as of 11:28, 20 July 2020
Character Field Transferred to Microsoft Excel as NumericID: Q111872 The information in this article applies to:
SYMPTOMSA FoxPro character type field that contains numbers is converted to a numeric field in Microsoft Excel when the FoxPro dynamic data exchange (DDE) functions are used. RESOLUTIONTo avoid this situation, do one of the following:
MORE INFORMATIONSteps to Reproduce Problem1. Open Microsoft Excel with Sheet1 as the active worksheet. 2. Open FoxPro for Windows and issue the following commands from the Command window: CREATE TABLE xddetst.dbf (fld1 C(8)) APPEND BLANK REPLACE fld1 WITH "12345678" mchan = DDEINITIATE("EXCEL","SHEET1") =DDEPOKE(mchan,"R1C1",fld1) With the above DDEPOKE() command FoxPro will send the FLD1 field contents to cell A1 in Sheet1 of Microsoft Excel. 3. Press ALT+TAB to switch to Microsoft Excel. Here you will see that the contents of FLD1 were transferred to cell A1 in Sheet1 as a numeric field. In Microsoft Excel, to enter a number, string, or formula as text, you have to prefix the data with a single quotation mark. If you select cell A1, you will see that the Formula Bar does not display a single quotation mark before the cell's contents. Additional reference words: FoxWin 2.50 2.50a 2.50b number format KBCategory: kbinterop kbprg KBSubcategory: FxinteropDde |
Last Reviewed: June 26, 1995 |