General information
Title:
Error in application
I have this annoying problem:
Someone has a database in foxpro access it through the hyperterminal software, and i made some modifications to a program file to create pivot tables from foxpro.
Here in my portable it works perfect, but in that machine displays the next messages errors:
ALIAS SIETAB IS NO FOUNT
ALIAS IS NO FOUNT
OPERATOR / OPERAND TYPE MISMATCH
OLE ERROR CODE 0X800A03EC UNKNOWN COM STATUS CODE
VARIABLE OSOURCERANGE IS NO FOUND
OBJECT OPIVOTTAVLE IS NO FOUND
And this is taking my patience off. Please help me to solve this: this is my code to the prg file:
procedure openvsclosed
LOCAL lnFil, lnCol, lcRango, lcPlanilla, oExcel
*set step on
Wait window "Iniciando Excel" nowait
dirxls = SYS(5) + CURDIR() + "general.xls"
* lnFil = RECCOUNT("ingestad") + 1
* lnCol = FCOUNT("ingestad")
* lcRango = "A1:" + CHR(64+lnCol) + ALLTRIM(STR(lnFil))
* lcHoja = "ingestad"
*close tables
select SIETAB
lnFil = RECCOUNT("sietab") + 1
lnCol = FCOUNT("sietab")-4
lcRango = "A1:" + CHR(64+lnCol) + ALLTRIM(STR(lnFil))
*--- Creo objeto Excel
oExcel = createobject("excel.application")
oExcel.Application.Visible = .T.
* Read the test data into an Excel spreadsheet.
oWorkbook = oExcel.Workbooks.Open( DIRXLS )
* Define an Excel range object with the source data.
* (I hard-coded the range values for the sake of simplicity.)
oWorkbook.Sheets("Hoja1").Select
oWorkbook.Sheets.Add
oSourcesheet= oWorkbook.Sheets("Hoja1")
oSourcerange = oSourcesheet.Range(lcRango)
* Define an Excel range object to dump the results.
oWorkbook.Sheets("Hoja2").Select
oTargetSheet= oWorkbook.Sheets("Hoja2")
oTargetRange= oTargetSheet.Range("B3")
* Create a pivot table object.
oPivotTable = oExcel.Sheets("hoja1").PivotTableWizard( 1,; && source is internal data.
oSourceRange, ;
oTargetRange, ;
"PivotTable", .T., .T. )
* Define how the data would initally be arranged in
* the pivot table.
oPivotTable.PivotFields("llamadas").orientation = 1 && row
*oPivotTable.PivotFields("yearmonth").orientation = 2 && column
oPivotTable.PivotFields("llamadas").orientation = 4 && data
*GENERA EL GRAFICO EN EXCEL
oWorkbook.Charts.Add
oWorkbook.ActiveChart.PlotArea.Select
oWorkbook.ActiveChart.ChartType = -4102 &&xl3DPie
oWorkbook.Sheets("Hoja2").Select
oWorkbook.Sheets("Hoja2").Name = "Llamadas abiertas vs. Cerradas"
oWorkbook.Sheets("Gráfico1").Select
oWorkbook.Sheets("Gráfico1").Name = "Gráfico Abiertas vs. Cerradas"
dirxls = SYS(5) + CURDIR() +"Abiertas vs Cerradas.xls"
oExcel.ActiveWorkbook.SaveAs (dirxls)
* eof()
wait window "Proceso Finalizado" nowait
return
endproc
I don't know if this problem its caused for the Hyperterminal. PLEASE HELP.
Thanks.
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only