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
Over the years of being a applications developer ( Delphi, Powerbuilder, VB, Agile Outsystems..etc). I have learned many things and I may need to refer to them in the future. Some of the tips may not be relevant with the later versions of the software. I am still in the process of transferring all my notes.
Monday, April 23, 2012
Get data from Excel via the clipboard
Labels:
Powerbuilder
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment