DEFINE VARIABLE Rowi AS INTEGER NO-UNDO. /* Worksheet row counter */
DEFINE VARIABLE ItemName AS CHARACTER NO-UNDO. /* Item Name */
DEFINE VARIABLE CustName AS CHARACTER NO-UNDO. /* Customer name receptor */
DEFINE VARIABLE YTDsales AS CHARACTER NO-UNDO. /* YTD sales receptor */
DEFINE VARIABLE StateAbr AS CHARACTER NO-UNDO. /* State name receptor */
DEFINE VARIABLE ZipCode AS CHARACTER NO-UNDO. /* Zip code receptor */
DEFINE VARIABLE Sheet1 AS INTEGER NO-UNDO. /* DDE-ID to worksheet */
DEFINE VARIABLE DDEframe AS HANDLE NO-UNDO. /* DDE frame handle */
CREATE FRAME DDEframe. /* Create DDE frame */
. . .
/* Open a DDE conversation with Sheet1 and create 10 Customer records from
the data in four columns of the worksheet. */
DDE INITIATE Sheet1 FRAME DDEframe APPLICATION "Excel" TOPIC "Sheet1".
REPEAT Rowi = 2 TO 11:
CREATE Customer.
Customer.CustNum = Rowi - 1.
ItemName = "R" + STRING(Rowi) + "C1".
DDE REQUEST Sheet1 TARGET CustName ITEM ItemName.
Customer.Name = CustName.
ItemName = "R" + STRING(Rowi) + "C2".
DDE REQUEST Sheet1 TARGET YTDsales ITEM ItemName.
Customer.YtdSls = DECIMAL(YTDsales).
ItemName = "R" + STRING(Rowi) + "C3".
DDE REQUEST Sheet1 TARGET StateAbr ITEM ItemName.
Customer.State = StateAbr.
ItemName = "R" + STRING(Rowi) + "C4".
DDE REQUEST Sheet1 TARGET ZipCode ITEM ItemName.
Customer.PostalCode = INTEGER(ZipCode).
RELEASE Customer.
END.
. . .
|