>>>Anyway, I have two other questions:
>>>
>>>1) Is it possible to add new sheets to already created file? I don't see this option doing it interactively.
>>>
>>>2) If I need to show information from different tables, what is the best way: two separate sheets? Or combine information into one cursor?
>>>How would you do it?
>>
>>
>>To add a new sheet:
>>
>>#define xlLastCell 11
>>#define xlCellValue 1
>>#define xlEqual 3
>>
>>LOCAL oExcel AS Excel.Application, loSheetAfter
>>oExcel = CREATEOBJECT([Excel.Application])
>>oExcel.Workbooks.Open([d:\book1.xls])
>>oExcel.Visible = .t.
>>m.loSheetAfter = oExcel.ActiveWorkbook.Sheets(oExcel.ActiveWorkbook.Sheets.Count)
>>oExcel.ActiveWorkbook.Sheets.Add(,m.loSheetAfter,1)
>>
>>
>>2. It depends if both tables contains different types of data it is better to show it in a new sheet, but if the data is similar and all rows doesn't exceed 65535 rows then show it in one sheet.
>>
>>(I now will try with search and format :o)
>
>Thanks, I almost missed this reply. Do we need to set Excel visible?
>
>Also back to the first problem. I tried to combine your code and Cetin's <g>
>
>I have:
>
>loExcel.Range([A1], loExcel.Selection.SpecialCells(xlLastCell)).Select
> loExcel.Selection.FormatConditions.Delete
> loExcel.Selection.FormatConditions.Add(xlExpression,, '=Left($A1,7)="TOTALS:"')
>
> With loExcel.Selection.FormatConditions(1)
> .Font.Bold = .T.
> .Interior.ColorIndex = 4
> Endwith
>
>But it doesn't do anything. I do have TOTALS: in the first column.
The reason that code didn't work was that I somehow removed Save() from my code <g>
If it's not broken, fix it until it is.
My Blog