Consultor Eletrônico



Kbase P112258: How to add validation on MS Excel cells using ActiveX Automation Server
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   5/29/2007
Status: Unverified

GOAL:

How to add validation on MS Excel cells using ActiveX Automation Server

GOAL:

How to to put a validation on one of the Excel cells from Progress

FIX:


The following code allows to add a validation on the cell A2: Only decimals between 10 and 20 will be accepted in this cell.

DEFINE VARIABLE chExcel AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE chWorksheet AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE chWorkbook AS COM-HANDLE NO-UNDO.

CREATE "excel.application" chExcel.

chExcel:visible = true.

chWorkbook = chExcel:Workbooks:Add().

chWorkbook:Worksheets(1):Range("A2"):Validation:Add (
2, /* xlValidateDecimal */
1, /* AlertStyle: xlValidAlertStop*/
1, /* -Operator: xlBetween */
"10", /* -Formula1 */
"20" /* -Formula2 */
).

/* ... */