General information
Category:
COM/DCOM and OLE Automation
Environment versions
Network:
Windows 2003 Server
Hello Dear
Hope this will help
WAIT WINDOW "Please Wait ... " nowait
#DEFINE xlDBF3 8
lcXLSFile = GETFILE("xls")
IF !empty(lcXLSFile)
*lcXLSFile = Sys(5)+Curdir()+"MyXLS.xls"
lcOutPath = 'Xls2DBF'
IF !Directory(m.lcOutPath)
MD (m.lcOutPath)
ENDIF
ox = Createobject('Excel.Application')
WITH ox
.Workbooks.Open(m.lcXLSFile)
FOR Each loSheet In .ActiveWorkbook.Sheets
IF loSheet.UsedRange.Rows.Count> 0
loSheet.Activate
loSheet.Range('A1').Select
loSheet.SaveAs(Addbs(Fullpath(m.lcOutPath))+loSheet.Name, xlDBF3)
ENDIF
ENDFOR
.ActiveWorkbook.Saved = .T.
.Quit
ENDWITH
*lcXLS = Sys(5)+Curdir()+'myXLS.xls'
lcXLS = lcXLSFile
lcConn = "Driver={Microsoft Excel Driver (*.xls)};"+;
"DriverId=790;Dbq="+m.lcXLS+;
";DefaultDir="+JustPath(m.lcXLS)+";"
lnHandle = SQLStringConnect(m.lcConn)
SQLTables(m.lnHandle,"", "SheetNames")
SCAN
lcTableName = Trim(SheetNames.Table_Name)
lcOutput = Chrtran(m.lcTableName,' $','_')
SQLExec(m.lnHandle,'select * from ['+m.lcTableName+']',m.lcOutput )
ENDSCAN
SQLDisconnect(m.lnHandle)
MESSAGEBOX("Done,4+32+512,"XLS2DBF")
XLS2DBFXLS2DBFelse"
MESSAGEBOX("No file selected","XLS2DBF")
ENDIF
* Select and browse cursors in data session
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only