Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Cetin Basoz
  Where is Cetin Basoz?
 Cetin Basoz
 To: josue vargas
  Where is josue vargas?
 josue vargas
Subject: RE: extracting data from memo field
Thread ID: 143603 Message ID: 143655 # Views: 2 # Ratings: 0
Version: Visual FoxPro 8 Category: Databases, Tables and SQL Server
Date: Thursday, August 30, 2007 2:40:39 PM         

> how am i going to extract data from memo field and import it to microsoft excel??
> Josue Val A. Vargas
> Software Engineer

For sending data to MS Excel use oledb. ie:

 'select first_name,last_name,CAST(CHRTRAN(notes,CHR(13),"") as M) as Notes from employee',;

function VFP2Excel
lparameters tcDataSource, tcSQL, tcSheetName
Local loConn As AdoDB.Connection, ;
	loRS As AdoDB.Recordset,;
	oExcel as Excel.Application

loConn = Createobject("Adodb.connection")
loConn.ConnectionString = "Provider=VFPOLEDB;Data Source="+m.tcDataSource
loRS = loConn.Execute(m.tcSQL)
oExcel = Createobject("Excel.Application")
With oExcel
	.Visible = .T.
	With .ActiveWorkBook.ActiveSheet
		.Name = m.tcSheetName
		FOR ix=1 TO loRS.Fields.Count
			.Cells(1,m.ix).Value = PROPER(loRs.Fields(m.ix-1).Name)
		.Range('A2').CopyFromRecordSet( loRS )
		.UsedRange.Rows(1).Font.Bold = .t.

Cetin Basoz


extracting data from memo field Posted by josue vargas @ 8/30/2007 8:37:21 AM
RE: extracting data from memo field Posted by Jeremy Climaco @ 8/30/2007 9:45:11 AM
RE: extracting data from memo field Posted by Cetin Basoz @ 8/30/2007 2:40:39 PM