how to send to excell, lookup, return corresponding entry

bwalker5839

New Member
Progress 91b; given a drawing #, how can i open an Excel spreadsheet, lookup the drawing# in col 1 & return the value in column 4 (path to the drawing).
Must Excel be on the users workstation? or on the server where the spreadsheet is? Does Excell need to be running? or can the user start it?
 
I hope I understood you right now...

Using a com-object you can do about anything you want to with Word, Excel etc..

Here is a sample code for opening an excel-sheet, selecting the value in cell C4 and displaying it

/* Create a handle to a com-object*/
DEF VAR ch-Excel AS COM-HANDLE.

/* Create an Excel-application */
CREATE "Excel.Application" ch-Excel.

/* If you actually want the user to SEE the document you change this to true*/
ch-Excel:VISIBLE = FALSE.

/* Open the file in which the path is stored */
ch-Excel:workbooks:ADD ("c:\temp\lena.xls").

/* Tell the world the value in cell C4*/
MESSAGE ch-excel:Range("C4"):VALUE.

/* close the document and release the object */
ch-excel:ActiveWindow:Close.
RELEASE OBJECT ch-excel.
ch-excel = ?.



Hope that helped you on your way
/Pejgan
 
Back
Top