>Hi,
>
>I open a workseet in VFP 9, there are 1 sheet only,
>and I want to add a new sheet after the existing worksheet.
>
>I found the Excel Macro command is
> Sheets.Add After:=Sheets(Sheets.Count)
>
>how to convert it VFP 9 coding ?
It's a named parameter, you need to see in VBA help the exact order of parameters (perhaps it's the only one) and any parameters before it, or at least supply the proper number of commas. Assume that After is the third parameter, then this would be
oExcel.workbook.sheets.add(,,oExcel.workbook.sheets.count)
I don't have Excel on my machines so can't tell you which one exactly. You may find out by either by digging through VBA help in Excel, or by suspending your code before that command and then trying out in command window - Intellisense will read Excel's DOM and will show you the list of parameters when you open the parenthesis.