oSheet is NOT a property of the excel object.
I suggest you get the book 'Microsoft Office Automation' by Tamar Granor from
www.Hentzenwerke.comPeter
>>>Does it work now?
>>>
>>>Three comments:
>>>
>>>1. You don't need GO TOP before a SCAN.
>>>
>>>2. It helps if you put computer code (in the UT) between the codes < pre > and < /pre > (without the spaces). In this case, spaces are maintained; the result is more readable.
>>>
>>>3. If you transfer lots of data, it is very slow to insert each cell individually. In this case, you might use copy & paste, or copy to DBF or to text delimited or something, and insert lots of records into Excel with a single command. Of course, also using Automation.
>>>
>>>>Hi Hilmar,
>>>>
>>>>
>>>> This is my code,
>>>>
>>>>ole = CreateObject("Excel.Application")
>>>>With ole
>>>> nrow=7
>>>> nrecno=1
>>>> Select cur_inv
>>
>>>> Go Top
>>>> SCAN
>>>> .Cells(nrow,1).Value=cur_inv.invdate
>>>> .Cells(nrow,2).Value=cur_inv.icsno
>>>> .Cells(nrow,3).Value=cur_inv.loctid
>>>> nrow = nrow+1
>>>> nrecno = nrecno+1
>>>> IF nrecno=60 THEN
>>>> nrow=7
>>>> nrecno=1
>>>>
>>>> with This
>>>> local loWorkbook
>>>> loWorkbook = .oSheet.Parent
>>>> .nActiveSheet = .nActiveSheet + 1
>>>> if This.nActiveSheet > loWorkbook.Sheets.Count
>>>> loWorkbook.Sheets.Add(NULL, loWorkbook.Sheets(loWorkbook.Sheets.Count))
>>>> .oSheet = loWorkbook.ActiveSheet
>>>> else
>>>> .oSheet = loWorkbook.Sheets(This.nActiveSheet)
>>>> endif
>>>> .nRow = 1
>>>> .nCol = 1
>>>> endwith
>>>>
>>>>
>>>> ENDIF
>>>> SELECT cur_inv
>>>> ENDSCAN
>>>>
>>>>ENDWITH
>>
>
>Hi Hilmar,
>
> it gives me the same result," Unknown Member oSheet".
>
>
> ole = CreateObject("Excel.Application")
> With ole
> nrow=7
> nrecno=1
> Select cur_inv
> SCAN
> .Cells(nrow,1).Value=cur_inv.invdate
> .Cells(nrow,2).Value=cur_inv.icsno
> .Cells(nrow,3).Value=cur_inv.loctid
> nrow = nrow+1
> nrecno = nrecno+1
> IF nrecno=60 THEN
> nrow=7
> nrecno=1
>
> with This
> local loWorkbook
> loWorkbook = .oSheet.Parent
> .nActiveSheet = .nActiveSheet + 1
> if This.nActiveSheet > loWorkbook.Sheets.Count
> loWorkbook.Sheets.Add(NULL, loWorkbook.Sheets(loWorkbook.Sheets.Count))
> .oSheet = loWorkbook.ActiveSheet
> else
> .oSheet = loWorkbook.Sheets(This.nActiveSheet)
> endif
> .nRow = 1
> .nCol = 1
> endwith
>
> ENDIF
> SELECT cur_inv
> ENDSCAN
>
>EndWith
>
Peter Cortiel