FUNCTION buildexcel()
*-------------------
local oExcel
local oBook
local oSheet
local nLine:=1
select 3
use mach
oExcel := CREATEOBJECT( "Excel.Application" )
oBook := oExcel:WorkBooks:Add()
oSheet:= oBook:Worksheets(1)
nLine:=1
3->(DBGOTOP())
DO WHILE !(3)->(EOF())
oSheet:Cells( nLine, 1 ):Value = (3)->mc_serial
oSheet:Cells( nLine, 2 ):Value = (3)->mc_name
nLine:=nLine+1
(3)->(DBSKIP(1))
ENDDO
oExcel:Visible := .T.
return nil
Ehab Samir Aziz wrote:There is no a class called createobject .
You have to use xHarbour or link hbole.lib.
FUNCTION buildexcel()
*-------------------
local oExcel
local oBook
local oSheet
local nLine:=1
select 3
use mach
oExcel := CREATEOLEOBJECT( "Excel.Application" )
oBook:=OleInvoke( OleGetProperty( oExcel, "WorkBooks" ), "Add" )
oSheet:=OleInvoke( OleGetProperty( oExcel, "WorkSheets(1)" ))
nLine:=1
3->(DBGOTOP())
DO WHILE !(3)->(EOF())
oSheet:Cells( nLine, 1 ):Value = (3)->mc_serial
oSheet:Cells( nLine, 2 ):Value = (3)->mc_name
nLine:=nLine+1
(3)->(DBSKIP(1))
ENDDO
oExcel:Visible := .T.
return nil
FUNCTION buildexcel()
local oExcel , oBook, oSheet
local nLine :=1
oExcel = CREATEOLEOBJECT( "Excel.Application" )
oBook = OleInvoke( OleGetProperty( oExcel, "WorkBooks" ), "Add" )
oSheet = OleGetProperty( oBook, "WorkSheets", 1 )
OleSetProperty( OleGetProperty( oSheet, "Cells", nLine, 1 ), "Value", "test" )
OleSetProperty( oExcel, "Visible", .t. )
return nil
FUNCTION ADDNMRNG_WORK()
//----------------------
LOCAL cPath := "E:\programs\clipper\fwh\sitex\OLE.XLS"
LOCAL oExcel
LOCAL oBook
LOCAL osheet
LOCAL nline:=0
oExcel := CreateOLEObject("Excel.Application")
OLESetProperty(oExcel,"Visible",TRUE)
oBook:=OleInvoke( OleGetProperty( oExcel, "WorkBooks" ), "Add" )
oSheet:=OleInvoke( OleGetProperty( oBook, "Worksheets(1)" ))
OLEInvoke(oBook,"Open",cPath)
select 3
use mach
nLine:=1
3->(DBGOTOP())
DO WHILE !(3)->(EOF())
oSheet:Cells( nLine, 1 ):Value = (3)->mc_serial
oSheet:Cells( nLine, 2 ):Value = (3)->mc_name
nLine:=nLine+1
(3)->(DBSKIP(1))
ENDDO
OLEInvoke(oExcel,"Quit")
RETURN NIL
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 76 guests