How To Use the DataToClip Method

Last reviewed: January 10, 1997
Article ID: Q156267
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, version 5.0

SUMMARY

You can easily send the contents of a table or a portion of the contents of a table, cursor, or view to the Clipboard with the DataToClip() method.

MORE INFORMATION

With the table open, issue this command in the Command window:

   _VFP.DataToClip()

You can then paste the records that have been copied to the Clipboard into a document or worksheet. The online documentation has an example of using the DataToClip method from an Excel module that is using FoxPro as an OLE server. This code needs some modification to run. The Help file and the Online Documentation give the following syntax:

   DataToClip([nWorkArea | cTableAlias]|[, nRecords] [, nClipFormat])

If the nClipFormat property is 1, columns are space-delimited. If the nClipFormat property is 3, the columns are delimited with tabs (which is nice for creating tables in Microsoft Word and Microsoft Excel). The default is to copy all records from the currently selected work area, so be sure to specify nRecords if it is a table with a large number of records.

If you would like to copy only some fields or if you want records based on some criteria, issue a SELECT - SQL command first and use the DataToClip method on the cursor created.

One limitation is that the DataToClip method does not handle .NULL. field values. It may or may not copy the record containing the .NULL. value, or other records may be missing.

REFERENCES

For more information about the changes to the example in the Online documentation, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q156453
   TITLE     : DOCERR: Excel Code in Chapter 16 of Online Docs Incorrect


KBCategory: kbprg kbhowto
KBSubcategory: FxprgBrowse
Additional reference words: 5.00 kbdsd VFoxWin



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: January 10, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.