Get data from Excel via the clipboardTag(s): Datawindow


OLEObject  excel

Integer    li_RetValue, li_rtn
Boolean    lb_sheet_rtn
Long       ll_cnt


excel = create OLEObject

li_rtn = excel.ConnectToNewObject("excel.application")
IF li_rtn <> 0 THEN
    MessageBox('Excel erro','can not run Excel Program')
    DESTROY excel
    RETURN 0
END IF

excel.WorkBooks.Open( "c:\mysheet.xls" )
excel.Application.Visible = false
excel.windowstate = 2 // 1 : Normal, 2 : Minimize, 3 : Maximize

lb_sheet_rtn = excel.worksheets(1).Activate
excel.Worksheets(1).Range("A1:E5000").Copy  //  copy to clipboard
ll_cnt = dw_1.importclipboard()
IF ll_cnt <<= 1 THEN
    Messagebox("Inf", "Could not find .")
END IF

excel.Worksheets(1).Range("A10000:A10000").Copy  //reset clipboard
excel.Application.Quit
excel.DisConnectObject()
DESTROY excel

See this related howto
See also this related howto


blog comments powered by Disqus