Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP2Excel problem
Message
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01385377
Message ID:
01385471
Views:
134
Can anyone else please also try it and suggest workaround? It's very urgent for us.

>Cetin,
>
>I tried the simpliest test
>
>
>OPEN DATABASE OurProductionDatabase
>* Create a cursor with data
>
>LOCAL lcTest
>lcTest = SYS(2023)
>COPY TO ADDBS(lcTest) + 'temp.dbf'
>
>Local oExcel
>oExcel = Createobject("Excel.Application")
>With oExcel
>	.WorkBooks.Add
>	.Visible = .T.
>	VFP2Excel(lcTest,;
>		'select * from temp',;
>		.ActiveWorkBook.ActiveSheet.Range('A1'))
>	.ActiveWorkBook.ActiveSheet.UsedRange.Columns.Autofit()
>Endwith
>*---------------------------------------------------------------------------------
>Function VFP2Excel
>	Lparameters tcDataSource, tcSQL, toRange
>	Local loConn As AdoDB.Connection, ;
>		loRS As AdoDB.Recordset, ;
>		ix
>	loConn = Createobject("Adodb.connection")
>	loConn.ConnectionString = "Provider=VFPOLEDB;Data Source=" + m.tcDataSource
>	loConn.Open()
>	loRS = loConn.Execute(m.tcSQL)
>
>	For ix=1 To loRS.Fields.Count
>		toRange.Offset(0,m.ix-1).Value = Proper(loRS.Fields(m.ix-1).Name)
>		toRange.Offset(0,m.ix-1).Font.Bold = .T.
>	Endfor
>	toRange.Offset(1,0).CopyFromRecordSet( loRS )
>	loRS.Close
>	loConn.Close
>Endfunc
>
>
>And it gave me unspecified error. Do you see a workaround?
>
>Thanks a lot in advance.
>
>BTW, it gives me now the same error even with the local database.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform