Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Convert to excel book
Message
From
12/09/2005 02:23:29
 
 
To
12/09/2005 02:02:27
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01048102
Message ID:
01048628
Views:
26
When someone writes some code for you, we rarely have the chance to really test the program, so you have to check for typos. Is you read the code closely, you will see both loWorkbook and loWorkbooks. It's quite clear that loWorkbook should be loWorkbooks, you should also be able to find that error yourself.

>hi,
>thank you,
>i try as under i get error message Object "LOWORKBOOK" is not found
>
>
>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.
>m.qasem
>
>>Mohammed
>>
>>>&&i need to insert at the new excle sheet (test),just what i select from am2.
>>>&& any way to insert as my select ex...
>>>first sheet have only"ADSL 1"
>>>second sheet have "B ISDN ")
>>>therd sheet have "LL" , or i must do that manyaly
>>
>>You can easily run part of the code in a loop and use either a SELECT ... WHERE or a SET FILTER to get your three subsets of data
>>
>>You can work with alternate sheets of the workbook with code like this:
>>
>>
? 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
>>
>>
>>>&& and via getdir () inside the code ,i can choice the place to save this excel book with new name.
>>
>>capture the result of getdir() to a variable and use it in the call to the Close() method.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform