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 integer iLen ;Holds length of string received from Excel 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 strlen szText iLen ;Get length of string if iLen == 2 ;Indicates empty cell exitwhile ;Exit the while loop. else strfmt sRowCol "R%dC%d" iRow iCol2 ddepoke LinkVar sRowCol szText ;Write data to 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