HarrisD1200
Technical User
Hi! I'm using DDE to pull data from a spreadsheet, and write it to a text file. This works perfectly, with only one problem. There is always a blank line at the bottom of the data I write. This throws off my program when I read the data back in. Is there an easy way to remove this blank line?
PS, this blank line appears to be created when a file is opened. The text file is deleted before I run the script.
My program is pretty much pulled straight from the DDE example on aspectscripting.com. TIA!
_____________________________________________________
Proc RunDDE
long LinkVar, SystemVar ;* Variables containing DDE Id's.
fopen 1 "C:\Files\Excel_Text.txt" Create ;* RAW MODE
if ddeinit SystemVar "excel" "system"
ddeexecute SystemVar "[APP.MINIMIZE()]" ;* Minimize Excel
if ddeinit LinkVar "excel" "Sheet1" ;* Link to Sheet 1
While Ro < 67 ;* Last Row in Excel
strfmt sZer "%s%d%s%d" sStrR Ro sStrC C0
strfmt sOne "%s%d%s%d" sStrR Ro sStrC C1
strfmt sTwo "%s%d%s%d" sStrR Ro sStrC C2
strfmt sThr "%s%d%s%d" sStrR Ro sStrC C3
;*** GET THE DATA FROM THE ROWS AND COLUMNS IN EXCEL ****
Dderequest LinkVar sZer sTok0
fputs 1 sTok0
Dderequest LinkVar sOne sTok1
fputs 1 sTok1
Dderequest Linkvar sTwo sTok2
fputs 1 sTok2
Dderequest Linkvar sThr sTok3
fputs 1 sTok3
Ro++ ;* Increment Row Number
Endwhile
fclose 1
PS, this blank line appears to be created when a file is opened. The text file is deleted before I run the script.
My program is pretty much pulled straight from the DDE example on aspectscripting.com. TIA!
_____________________________________________________
Proc RunDDE
long LinkVar, SystemVar ;* Variables containing DDE Id's.
fopen 1 "C:\Files\Excel_Text.txt" Create ;* RAW MODE
if ddeinit SystemVar "excel" "system"
ddeexecute SystemVar "[APP.MINIMIZE()]" ;* Minimize Excel
if ddeinit LinkVar "excel" "Sheet1" ;* Link to Sheet 1
While Ro < 67 ;* Last Row in Excel
strfmt sZer "%s%d%s%d" sStrR Ro sStrC C0
strfmt sOne "%s%d%s%d" sStrR Ro sStrC C1
strfmt sTwo "%s%d%s%d" sStrR Ro sStrC C2
strfmt sThr "%s%d%s%d" sStrR Ro sStrC C3
;*** GET THE DATA FROM THE ROWS AND COLUMNS IN EXCEL ****
Dderequest LinkVar sZer sTok0
fputs 1 sTok0
Dderequest LinkVar sOne sTok1
fputs 1 sTok1
Dderequest Linkvar sTwo sTok2
fputs 1 sTok2
Dderequest Linkvar sThr sTok3
fputs 1 sTok3
Ro++ ;* Increment Row Number
Endwhile
fclose 1