Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel to VFP
Message
From
15/12/2005 05:46:04
 
 
To
14/12/2005 23:44:11
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01078129
Message ID:
01078151
Views:
25
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
Map
View

Click here to load this message in the networking platform