Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Examples for Word and Excel automation
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Examples for Word and Excel automation
Divers
Thread ID:
00609170
Message ID:
00609170
Vues:
63
Hello Everybody

Maybe I missed something but I can find everything foxpro related here at the UT, everything but examples (word automation, excel automation yada yada)

I was looking for a excel automation example to show me how to dynamically fill the sheet verses the export command and I couldn't find anything here (at the UT)


this is what I made after seeing a example at the microsoft KB
LOCAL ln_step, ln_cou, ln_cou2, ln_count, p_pack, p_ven
SET DELETE ON

SELECT pack_slip, vendor, SUM(TOTAL) AS 'total' ;
	FROM (gcOld_Dir)+'recon3' ;
	GROUP BY vendor, pack_slip ;
	ORDER BY vendor, pack_slip ;
	INTO TABLE (gcOld_Dir)+'recon4'
ln_cou = _TALLY
SELECT * ;
	FROM (gcOld_Dir)+'recon3' ;
	ORDER BY vendor, pack_slip ;
	INTO TABLE (gcOld_Dir)+'recon5'
ln_cou2 = _TALLY
ln_count = (ln_cou * 2) + ln_cou2
oExcel = CREATEOBJECT("Excel.application")
SELECT recon5
WITH oExcel
*!* Add a new workbook
	.APPLICATION.workbooks.ADD
*!* Make Excel visible
	.VISIBLE = .T.
*!* Add records to workbook
	p_pack = ''
	p_ven = ''
	FOR ln_step = 1 TO ln_count
		IF recon5.pack_slip = p_pack AND recon5.vendor = p_ven
			.RANGE("A"+ALLTRIM(STR(ln_step))).VALUE = recon5.receipt_qt
			.RANGE("B"+ALLTRIM(STR(ln_step))).VALUE = recon5.DESCRIPTIO
			.RANGE("C"+ALLTRIM(STR(ln_step))).VALUE = recon5.receipt_co
			.RANGE("D"+ALLTRIM(STR(ln_step))).VALUE = recon5.TOTAL
			SKIP 1
			IF recon5.pack_slip = p_pack AND recon5.vendor = p_ven
				LOOP
			ELSE
				ln_step = ln_step + 1
				.RANGE("A"+ALLTRIM(STR(ln_step))).VALUE = 'Packing Slip Total'
				SELECT recon4
				LOCATE FOR recon4.pack_slip = p_pack AND recon4.vendor = p_ven
				IF FOUND() AND !EOF()
					.RANGE("B"+ALLTRIM(STR(ln_step))).VALUE = recon4.TOTAL
				ENDIF
				SELECT recon5
				LOOP
			ENDIF
		ELSE
			.RANGE("A"+ALLTRIM(STR(ln_step))).VALUE = recon5.vendor
			.RANGE("B"+ALLTRIM(STR(ln_step))).VALUE = recon5.pack_slip
			p_pack = recon5.pack_slip
			p_ven = recon5.vendor
			LOOP
		ENDIF
	ENDFOR
ENDWITH
Stephen McLaughlin
"Sexy Steve Valenteno", "Blastmaster"
stephenmclaughlin@gmail.com
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform