I have tried to tweak a script that was posted here to take data from an xcel spreadsheet and transmit to my phone system. The script get's the info from row 1 and column 1 and transmits it. However, it does not go past the 1st record. If I put 5 records in, it transmits the data from R-1 C-1 5 times. I am trying to enter
add-persi:stn,22459,,,,,,,,,,123456;^M
123456 is what is in the spread sheet and can be up to 100 variable numbers.
Here is the script -
;**************************************
; DDE code derived from samples at
; ;**************************************
;**************************************
; Declare DDE variables.
;**************************************
long LinkVar, SystemVar ;Variables containing DDE Id's.
string szText ;Text read from DDE link to Excel.
integer iRow, iCol1 ;Row and column variables
string sRowCol ;Holds request for row and column
;**************************************
; Main procedure below
;**************************************
proc main
string s1st, s2nd
s1st = "add-persi:stn,22459,,,,,,,,,,"
s2nd = ";^M"
;**************************************
; Code here for DDE input
;**************************************
iCol1 = 1 ;Column one
iRow = 1 ;Start reading with row 1
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
strreplace szText "`n" ""
strreplace szText "`r" ""
if strcmp szText "end" ;If cell contains the string exit
exitwhile ;Exit the while loop.
else
strcat s1st szText
strcat s1st s2nd
transmit s1st
pause 5
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
;**************************************
; End DDE code
;**************************************
endproc
add-persi:stn,22459,,,,,,,,,,123456;^M
123456 is what is in the spread sheet and can be up to 100 variable numbers.
Here is the script -
;**************************************
; DDE code derived from samples at
; ;**************************************
;**************************************
; Declare DDE variables.
;**************************************
long LinkVar, SystemVar ;Variables containing DDE Id's.
string szText ;Text read from DDE link to Excel.
integer iRow, iCol1 ;Row and column variables
string sRowCol ;Holds request for row and column
;**************************************
; Main procedure below
;**************************************
proc main
string s1st, s2nd
s1st = "add-persi:stn,22459,,,,,,,,,,"
s2nd = ";^M"
;**************************************
; Code here for DDE input
;**************************************
iCol1 = 1 ;Column one
iRow = 1 ;Start reading with row 1
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
strreplace szText "`n" ""
strreplace szText "`r" ""
if strcmp szText "end" ;If cell contains the string exit
exitwhile ;Exit the while loop.
else
strcat s1st szText
strcat s1st s2nd
transmit s1st
pause 5
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
;**************************************
; End DDE code
;**************************************
endproc