>CLOSE all >USE AM2 IN 0 >BROW >Select * from am2 ; > where INLIST( val(char3), 100, 201, 202, 203 ); > and ( inList( upper(allt(telno)), "ADSL 1")) ; > into table am3 nofilter > > > >loExcel = createobject( "excel.application" ) >loExcel.Visible = .t. > >loWorkbooks = loExcel.Workbooks >loWorkbooks.Add() >**************************** >? loWorkbook.Sheets.Count && examine how many sheets the workbook contains > >loSheet = loWorkbook.Sheets(2) && pick the second sheet > >loWorkbook.Sheets.Add() && add a new sheet to the Sheets collection >******************************** >loWorkbook = loExcel.ActiveWorkbook >loSheet = loExcel.ActiveSheet > >n = afields( laFields ) > >SCAN > > loRow = loSheet.Rows( recno() ) > for i = 1 to n > loCol = loRow.Cells(,i) > loCol.Value = evaluate( laFields[i,1] ) > endfor >endscan > >loCol = .null. >loRow = .null. > >loSheet = .null. >loWorkbooks = .null. > >loWorkbook.Close( .t., "test.xls" ) >loWorkbook = .null. > >loExcel.Quit() >loExcel = .null. >>thanks.
? loWorkbook.Sheets.Count && examine how many sheets the workbook contains >> >>loSheet = loWorkbook.Sheets(2) && pick the second sheet >> >>loWorkbook.Sheets.Add() && add a new sheet to the Sheets collection >>>>