![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Tue Apr 08, 2008 12:05 pm
by Rick Lipkin
Here is a code snipit I use.. I do not know if it will work on XLSx
Rick Lipkin
SC Dept of Health, USA
//------------------------------
cPATH := "C:\TEMP\MYFILE.XLS"
DO WHILE .T.
SITEDBF := "TEMP"+(SUBSTR(TIME(),7,2)+SUBSTR(TIME(),4,2))+".DBF"
IF .not. FILE( xVOL+"\DBTMP\"+SITEDBF )
EXIT
ENDIF
ENDDO
DBF_STRU := { }
AADD( DBF_STRU, { "SSN", "C", 11, 0 } )
AADD( DBF_STRU, { "NAME", "C", 30, 0 } )
AADD( DBF_STRU, { "ACT_TYPE", "C", 1, 0 } )
AADD( DBF_STRU, { "EMP_STAT", "C", 1, 0 } )
AADD( DBF_STRU, { "TOFROM", "C", 4, 0 } )
AADD( DBF_STRU, { "COSTCTR", "C", 6, 0 } )
AADD( DBF_STRU, { "FUND", "C", 6, 0 } )
AADD( DBF_STRU, { "RATE", "N", 10, 2 } )
AADD( DBF_STRU, { "SEMI", "N", 10, 2 } )
AADD( DBF_STRU, { "FY", "C", 4, 2 } )
AADD( DBF_STRU, { "COMMENTS", "C", 50, 0 } )
AADD( DBF_STRU, { "APPROVAL", "C", 1, 0 } )
AADD( DBF_STRU, { "SALARY", "N", 7, 0 } )
AADD( DBF_STRU, { "P0701", "C", 1, 0 } )
AADD( DBF_STRU, { "P0716", "C", 1, 0 } )
AADD( DBF_STRU, { "P0801", "C", 1, 0 } )
AADD( DBF_STRU, { "P0816", "C", 1, 0 } )
AADD( DBF_STRU, { "P0901", "C", 1, 0 } )
AADD( DBF_STRU, { "P0916", "C", 1, 0 } )
AADD( DBF_STRU, { "P1001", "C", 1, 0 } )
AADD( DBF_STRU, { "P1016", "C", 1, 0 } )
AADD( DBF_STRU, { "P1101", "C", 1, 0 } )
AADD( DBF_STRU, { "P1116", "C", 1, 0 } )
AADD( DBF_STRU, { "P1201", "C", 1, 0 } )
AADD( DBF_STRU, { "P1216", "C", 1, 0 } )
AADD( DBF_STRU, { "P0101", "C", 1, 0 } )
AADD( DBF_STRU, { "P0116", "C", 1, 0 } )
AADD( DBF_STRU, { "P0201", "C", 1, 0 } )
AADD( DBF_STRU, { "P0216", "C", 1, 0 } )
AADD( DBF_STRU, { "P0301", "C", 1, 0 } )
AADD( DBF_STRU, { "P0316", "C", 1, 0 } )
AADD( DBF_STRU, { "P0401", "C", 1, 0 } )
AADD( DBF_STRU, { "P0416", "C", 1, 0 } )
AADD( DBF_STRU, { "P0501", "C", 1, 0 } )
AADD( DBF_STRU, { "P0516", "C", 1, 0 } )
AADD( DBF_STRU, { "P0601", "C", 1, 0 } )
AADD( DBF_STRU, { "P0616", "C", 1, 0 } )
DBCREATE( xVOL+"\DBTMP\"+SITEDBF, DBF_STRU )
SELECT 9
IF NETUSE( xVOL+"\DBTMP\"+SITEDBF, .T.,5)
ELSE
SELECT( GOBACK )
_Cleanup()
RETURN(.F.)
ENDIF
nREC := 0
cSAY := "Opening Excel File "+STR(nREC)
oSAY:ReFresh()
SysReFresh()
oEXCEL := TOleAuto():New( "Excel.Application" )
oExcel:Workbooks:Open( cPATH )
oBook := oExcel:Get( "ActiveSheet" )
nROWS := oBook:UsedRange:Rows:Count()
nCOLS := oBook:UsedRange:Columns:Count()
SELECT 9
FOR nROW := 3 to nROWS
APPEND BLANK
FOR nCOL := 1 to nCOLS
xVALUE := oBook:Cells( nROW, nCOL):Value
FieldPut( nCol,xValue )
nREC++
cSAY := "Opening Excel File "+STR(nREC)
oSAY:ReFresh()
SysReFresh()
NEXT
NEXT
SELECT 9
dbCommit()
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Tue Apr 08, 2008 9:34 pm
by Gale FORd
Check out this link
http://office.microsoft.com/en-us/excel/HP100141031033.aspx#DatabaseFormats****** Other formats you can open but not save *******
Format Extension Description
DBF 3, DBF 4 .dbf dBase III and IV. You can open these files formats in Excel, but you cannot save an Excel file to dBase format.
Quattro Pro 5.0 (Win) .wb1 Quattro Pro version 5.0 for Windows. You can open Quattro Pro files in Excel by using a converter. You cannot save an Excel file to Quattro Pro format.
Quattro Pro 7.0 (Win) .wb3 Quattro Pro version 7.0 for Windows. You can open Quattro Pro files in Excel by using a converter. You cannot save an Excel file to Quattro Pro format.
*** File formats that are not supported in Excel
The following file formats are no longer supported in Office Excel 2007. You cannot open or save files in these file formats.
Format Extension Clipboard type identifiers
Excel Chart .xlc Excel 2.0, 3.0, and 2.x file formats
WK1, FMT, WK2, WK3, FM3, WK4 .wk1, .wk2, .wk3, .wk4, .wks Lotus 1-2-3 file formats (all versions)
Microsoft Works .wks Microsoft Works file format (all versions)
WQ1 .wq1 Quatro Pro for MS-DOS file format
DBF 2 .dbf DBASE II file format
Tips for file formats that are not supported by Excel
If a file format that you want to use is not supported in Excel, you can try the following:
Search the World Wide Web (WWW) for a company that makes file format converters for file formats that are not supported in Excel.
Save to a file format that another program supports. For example, you may want to import your spreadsheet into another program that does not support the Excel file format. But the other program may be able to import another supported file format, such as an XML spreadsheet or a text file format. In this case, you can save your workbook to the XML spreadsheet format, and then from the other program, import the XML file.