Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Re: VFP Excel Automation
Message
De
04/04/2016 11:31:46
Sonny Tabano
Trams Printwork, Inc.
Mabalacat, Philippines
 
 
À
04/04/2016 07:46:09
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
01634243
Message ID:
01634260
Vues:
62
Hi Hilmar,

Yes, that is my intention to generate formulae of the type "A1" in Excel in the same row
into columns from A to BZ or beyond BZ depending on the records to be created by the into cursor

I was able to solve it with these codes and so far it works now even after the "Z" ( I created up to "EZ" only)..

Thank you all for your help and suggestions

Sonny
**** to display formulae (totals at the bottom of the excel report)

Col02=3
lcASCIIcode=65+2     && 65 for chr(65)="A" + 2 = chr(67)= "C" where i want to start placing the formula

SELECT &lcFile2
GO top
DO WHILE .T. .and. .not. EOF()
      .Cells(row01,Col02).Borders(4).LineStyle = 1
      .Cells(row01+1,Col02).Value = Tgldebit
      .Cells(row01+1,Col02).Borders(4).LineStyle = 9

       DO WHILE .T.
              DO case
		    CASE Col02<=26
			      .Cells(row01+3,Col02).formula = "=SUM("+CHR(lcASCIIcode)+LTRIM(str(7))+":"+CHR(lcASCIIcode)+LTRIM(str(row01))+")"
			      .Cells(row01+3,Col02).Borders(4).LineStyle = 9
			       Col02=Col02+2
			       lcASCIIcode =  lcASCIIcode + 2
			       IF lcASCIIcode>90
				   lcASCIIcode = 65
			       ENDIF										   
			       EXIT
											   
  	           CASE Col02>=27 .and. Col02<=51
		            .Cells(row01+3,Col02).formula = "=SUM(A"+CHR(lcASCIIcode)+LTRIM(str(7))+":A"+CHR(lcASCIIcode)+LTRIM(str(row01))+")"
			     .Cells(row01+3,Col02).Borders(4).LineStyle = 9
			     Col02=Col02+2
			     lcASCIIcode =  lcASCIIcode + 2
			     IF lcASCIIcode>90
				 lcASCIIcode = 65
			     ENDIF										   
			     EXIT
	          CASE Col02>=52 .and. Col02<=77
	 	           .Cells(row01+3,Col02).formula = "=SUM(B"+CHR(lcASCIIcode)+LTRIM(str(7))+":B"+CHR(lcASCIIcode)+LTRIM(str(row01))+")"
			    .Cells(row01+3,Col02).Borders(4).LineStyle = 9
			    Col02=Col02+2
			    lcASCIIcode =  lcASCIIcode + 2
			    IF lcASCIIcode>90
			  	lcASCIIcode = 65
			     ENDIF										   
			     EXIT
 	          CASE Col02>=78 .and. Col02<=103
		           .Cells(row01+3,Col02).formula = "=SUM(C"+CHR(lcASCIIcode)+LTRIM(str(7))+":C"+CHR(lcASCIIcode)+LTRIM(str(row01))+")"
		           .Cells(row01+3,Col02).Borders(4).LineStyle = 9
			    Col02=Col02+2
			    lcASCIIcode =  lcASCIIcode + 2
			    IF lcASCIIcode>90
				lcASCIIcode = 65
			    ENDIF										   
			    EXIT
		 CASE Col02>=104 .and. Col02<=129
		          .Cells(row01+3,Col02).formula = "=SUM(D"+CHR(lcASCIIcode)+LTRIM(str(7))+":D"+CHR(lcASCIIcode)+LTRIM(str(row01))+")"
			  .Cells(row01+3,Col02).Borders(4).LineStyle = 9
			   Col02=Col02+2
			   lcASCIIcode =  lcASCIIcode + 2
			   IF lcASCIIcode>90
			      lcASCIIcode = 65
			   ENDIF										   
			   EXIT
	        CASE Col02>=130 .and. Col02<=156
		         .Cells(row01+3,Col02).formula = "=SUM(E"+CHR(lcASCIIcode)+LTRIM(str(7))+":E"+CHR(lcASCIIcode)+LTRIM(str(row01))+")"
			 .Cells(row01+3,Col02).Borders(4).LineStyle = 9
			  Col02=Col02+2
			  lcASCIIcode =  lcASCIIcode + 2
			  IF lcASCIIcode>90
		              lcASCIIcode = 65
			  ENDIF										   
			  EXIT
	    ENDCASE
    ENDDO								   
    skip
ENDDO
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform