proc main long LinkVar, SystemVar ;Variables containing DDE Id's. string szText ;Text read from DDE link to Excel. integer iRow, iCol1, iCol2 ;Row and column variables string sRowCol ;Holds request for row and column iCol1 = 1 ;Column one iCol2 = 2 ;Column two iRow = 1 ;Start reading with row 1 ;Set up DDE links to Excel's system and a spreadsheet. Excel ;must be running in order for this script to work properly. if ddeinit SystemVar "excel" "system" ddeexecute SystemVar "[FULL(TRUE)]" ;Maximize the spreadsheet. if ddeinit LinkVar "excel" "sheet1" ;Set up link to spreadsheet. while 1 ;Loop forever. strfmt sRowCol "R%dC%d" iRow iCol1 ;Format request for data from current row, column 1 dderequest LinkVar sRowCol szText ;Read data from spreadsheet, current row, column 1 if stricmp szText "exit`r`n" ;If cell contains the string exit exitwhile ;Exit the while loop. else strfmt sRowCol "R%dC%d" iRow iCol2 dderequest LinkVar sRowCol szText;Read data from spreadsheet, current row, column 2 endif iRow++ ;Increment row value endwhile ddeterminate LinkVar ;Break DDE link to spreadsheet. ddeterminate SystemVar ;Break DDE link to Excel. else errormsg "Couldn't establish DDE link to spreadsheet!" endif else errormsg "Couldn't establish DDE link to Excel!" endif endproc