Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Save dbf to xls
Message
From
20/02/2013 01:43:11
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01566425
Message ID:
01566435
Views:
58
this is it and beginning of Craig's program
close all
SELECT ctask
CopyToExcel("c:\Test Craig's BLOG\Test.XLSX", "Sheet1")



********************************
*!* Simple Sample Usage
********************************

*!*	DIMENSION aWrkSht(1), aCols(1)
*!*	m.lcXlsFile = GETFILE("Excel:XLS,XLSX,XLSB,XLSM")
*!*	IF FILE(m.lcXlsFile)
*!*		CLEAR
*!*		?AWorkSheets(@aWrkSht,m.lcXlsFile,.T.)
*!*		?AWorkSheetColumns(@aCols,m.lcXlsFile,"Sheet1")
*!*		AppendFromExcel(m.lcXlsFile, "Sheet1", "MyTable", "column1,column2,column3", "Recnum Is Not Null", "field1,field2,field3", "field1 > 14000")
*!*		SELECT MyTable
*!*		GO TOP IN "MyTable"
*!*		BROWSE LAST NOWAIT
*!*	ENDIF
*!*	CopyToExcel("C:\Test.xlsx", "Sheet1", "MyTable") && try xls, xlsb, and xlsm as well

**********************************
FUNCTION AppendFromExcel(tcXLSFile, tcSheet, tvWorkarea, tcExcelFieldList, tcExcelWhereExpr, tcTableFieldList, tcTableForExpr, tlNoHeaderRow)
	**********************************
>Please, show me your code.
>
>>if i close all before and select myfile i get alias does not exist.
>>if i open the file first then follow with select myfile i get error on this line shown below with 'table number is invalid'
>>
>>m.llOpenedtvWorkArea = .F.
>>	IF !USED(m.tvWorkarea) AND TYPE("m.tvWorkArea") = "C" AND FILE(DEFAULTEXT(m.tvWorkarea,"DBF"))
>>
>>>
>>>select myfile &&.dbf Remove the extension. ALIASes doesn't have one.
>>>
>>>
>>>>am giving it a try but i am doing something wrong here
>>>>select myfile.dbf gives me an error message
>>>>select 0 use myfile,dbf give me a table number is invalid message.
>>>>
>>>>what am i missing.
>>>>
>>>>k
>>>>
>>>>>>thanks Borislav, i read that - WAY over my head.
>>>>>>k
>>>>>>
>>>>>>>>Me again answering some of the issues in my first problem.
>>>>>>>>if i open the file the re-save with format number 51 it will save as an xlsx.
>>>>>>>>is there a way of doing this using the copy method without going through the opening xl method.
>>>>>>>>
>>>>>>>>k
>>>>>>>
>>>>>>>Check Using Excel 2007 File Formats in VFP 9.0
>>>>>
>>>>>You need only CopyToExcel function (but you need to add the whole file in your project).
>>>>>Use it like this:
>>>>>
>>>>>SELECT YourTableYouWantToExport
>>>>>CopyToExcel("c:\Test Craig's BLOG\Test.XLSX", "Sheet1")
>>>>>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform