Code: Select all
If ( oExcel := win_oleCreateObject( 'Excel.Application' ) ) == Nil
? 'Excel no disponible, ', win_OleErrorText()
Return Nil
Endif
oExcel:WorkBooks:Add()
oSheet := oExcel:ActiveSheet()
/* Rename Sheet Tab */
oSheet:Name := "Hoja1"
oSheet:Cells( 1, 1 ):Value := "Hoja1 - fila 1"
oSheet:Cells( 2, 1 ):Value := "Hoja1 - fila 2"
/* Add Sheet Tab */
//oExcel:Sheets:Add( ,oExcel:Sheets(1) )
oExcel:Sheets:Add( )
oSheet := oExcel:ActiveSheet()
oSheet:Name := "Hoja2"
oSheet:Cells( 1, 1 ):Value := "Hoja2 - fila1"
oSheet:Cells( 2, 1 ):Value := "Hoja2 - fila2"
/* Save as */
oExcel:ActiveWorkbook:SaveAs( "name.xls" )
oExcel:Visible := .T.He leído en algunos foros y la mayoría coinciden en que se debe realizar algo así:
Pero al hacerlo de esa forma me despliega error.you must add SHEETS
not Workbooks
oExcel.Sheets.Add()
If you want to add this sheet AFTER some other sheet:
oExcel.Sheets.Add(,oExcel.Sheets("Sheet1"))
Alguien sabe cómo puedo insertar hojas en orden específico.
Saludos,
Javier