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?
 Izmir
 Turkey
 Cetin Basoz
 To: josue vargas
  Where is josue vargas?
 manila
 Philippines
 josue vargas
 Tags
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:

VFP2Excel(_samples+'data\testdata.dbc',;
 'select first_name,last_name,CAST(CHRTRAN(notes,CHR(13),"") as M) as Notes from employee',;
 'Employees')

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
loConn.Open()
loRS = loConn.Execute(m.tcSQL)
oExcel = Createobject("Excel.Application")
With oExcel
	.WorkBooks.Add
	.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)
		endfor
		.Range('A2').CopyFromRecordSet( loRS )
		.UsedRange.Rows(1).Font.Bold = .t.
		.UsedRange.Columns.Autofit
		.UsedRange.Rows.AutoFit
	Endwith
Endwith
loRs.Close
loConn.Close


Cetin Basoz

ENTIRE THREAD

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