General information
Category:
COM/DCOM and OLE Automation
Currently I am using Visual Foxpro 5.0.
Here is the source code work with on sheet only on Excel
tmpsheet = GetObject('',"Excel.Sheet")
XLApp = tmpsheet.application
XLApp.Visible = .T.
XLApp.WorkBooks.Add()
s=1
XLSheet = XLApp.ActiveSheet
Sele 0
Use (mFile) Alias FileExcel
Go Top
xline=4
xTotal=0
Do While !Eof()
xTotal=xtotal+Val(extncost)
FOR xi = 1 to Fcount()
xiField=Field(xi)
If Type(Allt(xiField))='N'
XLSheet.Cells(D,xi).Value = Allt(Str(&xiField,12,2))
Else
XLSheet.Cells(D,xi).Value = Allt(&xiField)
Endif
ENDFOR
D=D+1
Skip
Enddo
XLSheet.Cells(D,3).Value = "Total Cost"
XLSheet.Cells(D,8).Value = Allt(Str(xtotal,12,2))
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only