Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Vfp2excel with memo
Message
From
17/10/2008 06:32:15
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
17/10/2008 04:14:06
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP1
Network:
Windows XP
Database:
Informix
Miscellaneous
Thread ID:
01355542
Message ID:
01355546
Views:
40
This message has been marked as the solution to the initial question of the thread.
>Hi all,
>
>I'm using this function to convert a dbf to xls. I have a memo field in the table but when one of its memo fields exceeds 912 characters it sticks with an OLE error(Undefined blabla). Any idea how to resolve?
>
>Tamas
>
>
>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
>
What a familiar code. You can then use this alternative:
* Author: Cetin Basoz
Function VFP2Excel
	Lparameters tcDataSource, tcSQL, toRange
	toRange.Parent.QueryTables.Add(;
		"OLEDB;Provider=VFPOLEDB;Data Source="+m.tcDataSource, m.toRange, m.tcSQL).Refresh
Endfunc
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform