Just do an oExcel.SaveAs("C:\Book3.xls"). Named parameters aren't allowed when doing Automation from FoxPro. The other parameters it put in the macro code appear to be default values, so you shouldn't have pass them. If you need to pass them, then you'll need to find the parameter order and pass them as you would to a function/method call.
>thanks for the info and code. works well. but now i want to save the workbook as a specific name in a specific folder. went into excel, recorded a macro and then look at the VB code. i added the oExcel. before the ActiveWorkbook.Saveas. but i get a syntax error when i execute it in the command window.
>
>oExcel = CREATEOBJECT('Excel.Application')
>oExcel.workbooks.add
>oExcel.ActiveWorkbook.SaveAs FileName:="C:\Book3.xls", FileFormat:=xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, CreateBackup:=False
>
>thanks
>
>brenda
>
>>LOCAL oExcel, lnlast, lcalias, lvalue, lnrow
>>oExcel = CREATEOBJECT('Excel.Application')
>>* Create a new work sheet
>>oExcel.Workbooks.Add
>>lcalias = ALIAS()
>>lnlast = FCOUNT()
>>lnrow = 0
>>SCAN
>> lnrow = lnrow + 1
>> FOR lni = 1 TO lnlast
>> lccell = CHR(64 + lni) + TRANSFORM(lnrow)
>> oExcel.Range(lccell).Select
>> lvalue = lcalias + "." + FIELD(lni)
>> oExcel.ActiveCell.Value = &lvalue
>> NEXT
>>ENDSCAN
>>Of course, if you have more than 26 fields, you'll have to make an adjustment >in the column name.
>
>>>What do you mean by "Automation"? and what is AFAIK?
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement