Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Importing to excel
Message
De
17/07/2008 11:12:10
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Produits tierce partie
Divers
Thread ID:
01331963
Message ID:
01331990
Vues:
9
>This seems complex but am looking for ideas. I want to dump a daily vfp table that produces 1 column of data with x number of rows.
>I want to import/append this 1 column into excel in the next available blank column. so each day the available blank column progresses such as A,B,C.....AA,BB,CC etc.

Actually it's easy Tim. ie:
rand(-1)
create cursor xx (myData c(10))
for ix = 1 to int(rand()*20)
	insert into xx values (textmerge('Day <<m.ix>>'))
endfor
select * from xx into array arrData


lcXLS = 'c:\MyFolder\myDays.xls'

oExcel = createobject('Excel.Application')
oExcel.visible = .t.
if file(m.lcXLS)
	oExcel.Workbooks.open(m.lcXLS)
	with oExcel.ActiveWorkBook.ActiveSheet
	 .range(;
		.Cells(1,.UsedRange.columns.count+1), ;
		.Cells( alen(arrData),.UsedRange.columns.count+1)).value = getArrayRef('arrData')
	endwith
else
	oExcel.Workbooks.add
	oExcel.ActiveWorkBook.saveas(m.lcXLS)
	with oExcel.ActiveWorkBook.ActiveSheet
	  .range(;
		.Cells(1,1), ;
		.Cells( alen(arrData),1)).value = getArrayRef('arrData')
	endwith
endif
oExcel.ActiveWorkBook.save

function getArrayRef(tcArrayName)
	return @&tcArrayName
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform