Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Re: VFP Excel Automation
Message
De
04/04/2016 05:54:57
Sonny Tabano
Trams Printwork, Inc.
Mabalacat, Philippines
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Re: VFP Excel Automation
Divers
Thread ID:
01634243
Message ID:
01634243
Vues:
86
Hi,everyone,

need some help on the following automation codes


1. This one works ok
lcASCIIcode=65
rows = 1
cols = 1

Do while .not. eof()

    WITH oExcel
            .Cells(rows,Cols).formula = "=SUM("+CHR(65)+LTRIM(str(7))+":"+CHR(65)+LTRIM(str(rows))+")"     & & Result is =sum(A7:Axx)  
    Endwith 
    skip
    cols = cols + 1
    rows = rows + 1

    lcASCIIcode= lcASCIIcode + cols
enddo


2. But when i tried to substitute the chr(66) into the following codes below so that Chr(66) would become chr(67) for the next loop and chr(68) on the next loop , it resulted into errors
(expected results are from =sum(A7:Axx) then to =sum(B7:Bxx) ,  then to =sum(C7:Cxx) .and so on......)

lcASCIIcode=65
rows = 1
cols = 1

Do while .not. eof()

    WITH oExcel
           .Cells(rows,Cols).formula = "=SUM("+CHR(lcASCIIcode)+LTRIM(str(7))+":"+CHR(lcASCIIcode)+LTRIM(str(rows))+")"
    Endwith 
    skip
    cols = cols + 1
    rows = rows + 1

    lcASCIIcode= lcASCIIcode + cols
   
enddo

I also tried this one but doesnt work also
  .Cells(rows,Cols).formula = "=SUM("+CHR(STR(lcASCIIcode))+LTRIM(str(7))+":"+CHR(STR(lcASCIIcode))+LTRIM(str(rows))+")"
Any help is highly appreciated,

thanks in advance


Sonny
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform