Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel cell value update automation?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01048762
Message ID:
01048772
Views:
12
Edgar

If I understand you correctly, you wish to populate the excel sheet from the foxpro array. Then you may use something like this (here is an example to work with character, numeric, and date types):
PROCEDURE yArray2Excel
Dimension Array2Excel(2,4)

FOR ia=1 TO ALEN(Array2Excel)
	Array2Excel[ia]= IIF(ia%3=0, DTOC(DATE()),;
				IIF(ia%2=0,['], "")+TRANSFORM(ia))
ENDFOR

Array2Excel[1,1]="Hello"     
Array2Excel[2,1]=DATETIME()

oExcel=Createobject("EXCEL.APPlication") 
oExcel.Visible=.T. 
oExcel.Workbooks.Add() 
oExcel.Range("A1:D2").Value = PassArray("Array2Excel") 

oExcel=null

RETURN
*--------------------------------------------
Procedure PassArray
Lparameters lcArrayName 
Return @&lcArrayName    && for VFP7 and above
*-----------------------------------------
>What is missing for enforement of value in Excel Spreadsheet...
>Here's my partial code
>
>   oExcel=CREATEOBJECT("Excel.Application")
>   With oExcel
>      .DisplayAlerts= .F.
>         .WorkBooks.Open(ALLTRIM(Charttabs.Sheet),0)
>         .Sheets(ALLTRIM(Charttabs.Tab)).Select()
>         DO PopulateExcelArray
>      .Quit
>   EndWith
>   Release oExcel
>
>Procedure PopulateExcelArray
>... && no problem retrieving information from spreadsheet
>      cRange= "A"+ AllTrim(Str(nRow)) && Column A4
>      .Range(cRange).Select()
>      &cArray(nRow,iColumn)= AllTrim(DTOC(.Range(cRange).Value))
>...
>   DO ProvideDesc
>EndProc
>
>PROCEDURE ProvideDesc
>... && no problem getting a description into my array
>   cDescription= cDescription+ ALLTRIM(IIF(ISNULL(.Range("AE3").Value)," ",AllTrim(TRANSFORM(.Range("AE3").Value))))
>   &cArray(2,26)= cDescription
>   DO UpdateSpreadsheet
>
>PROCEDURE UpdateSpreadsheet
>... && no problem to identify new values for spreadsheet
>            sRowID=ALLTRIM(STR(&cArray(3,1))
>...
>            sAE= CHRTRAN(CHRTRAN(sAE,CHR(9),""),"-","")
>... && What must be added to enforce this cell, say A199, to be populated?
>            IF !EMPTY(sA)
>               cCell="A"+sRowID
>               .Range(cCell).Select()
>               .Range(cCell).Value= CTOD(sA)
>            ENDIF
>
>
>Do I have an object.update missing? Where can I get a list of Excel Object interactions?
>
>TIA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform