Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Re: VFP Excel Automation
Message
From
04/04/2016 05:54:57
Sonny Tabano
Trams Printwork, Inc.
Mabalacat, Philippines
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Re: VFP Excel Automation
Miscellaneous
Thread ID:
01634243
Message ID:
01634243
Views:
101
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
Next
Reply
Map
View

Click here to load this message in the networking platform