Article ID: 156177
Article Last Modified on 10/15/2003
oObject.DataToClip lpvarWrkArea:=cCursorName,
lpvarNumRows:=nNumRows, lpvarClipFormat:=nFormat
1 (Default) Fields delimited with spaces
3 Fields delimited with tabs
If lpvarClipFormat is omitted, fields are delimited with spaces.
Public FoxApp As Object
Sub copyFoxdata()
' Starts the Visual FoxPro OLE Server
Set FoxApp = CreateObject("VisualFoxPro.Application")
' Closes any data files that may be open
FoxApp.Docmd ("CLOSE DATA")
' Sets the default path for the FoxPro server
' Change this path to match your Visual FoxPro directory
FoxApp.DefaultFilePath = "d:\VFP50\Samples\Data"
' Opens the sample Customer table
FoxApp.Docmd ("USE customer")
' The next 2 commands perform the same function: to copy the
' first record to the clipboard in the default format, which is
' delimited with spaces
FoxApp.DataToClip "customer", 1
FoxApp.DataToClip lpvarWrkArea:="customer", lpvarNumRows:=1
' Paste the Data onto a Sheet of the Active Workbook
ActiveWorkbook.Sheets(1).Activate
ActiveSheet.Paste
' The next 2 commands perform the same function: to copy the
' first record to the clipboard delimited with tabs
FoxApp.DataToClip "customer", 1, 3
' This command should be on one line
FoxApp.DataToClip lpvarWrkArea:="customer", lpvarNumRows:=1,
lpvarClipFormat:=3
' Paste the Data onto a Sheet of the Active Workbook
ActiveWorkbook.Sheets(2).Activate
ActiveSheet.Paste
' The next 2 commands perform the same function: to copy all records
' to the clipboard delimited with tabs
FoxApp.DataToClip "customer", , 3
FoxApp.DataToClip lpvarWrkArea:="customer", lpvarClipFormat:=3
' Paste the Data onto a Sheet of the Active Workbook
ActiveWorkbook.Sheets(3).Activate
ActiveSheet.Paste
' The next two commands end the Visual FoxPro session
FoxApp.Quit
Set FoxApp = Nothing
End Sub
Additional query words: kbdsd VFoxWin
Keywords: KB156177