just did a quick onceover... and it looks like you are missing a ENDIF somewhere...

So... just by eyeballing it.... I made the folllowing changes. (i haven't ran this!!! don't know if it works)

things i changed

1. remmoved the line if @error = 0, i think this was the missing ENDIF

2. Changed the WHILE...LOOP to a DO...UNTIL.

code:

Break on CLS
$input = "%0\..\wrksta.txt"
$output = "%0\..\msover.txt"

IF OPEN(1,$input,2) = 0
IF OPEN(2,$output,5) <> 0
?" There is something wrong !!!"
GOTO END
ENDIF

$Wrksta = ReadLine(1)
do
$dir=readvalue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\excel.exe","Path")
if exist("$dir"+"\excel.exe")
$excel=getfileversion("$dir"+"\excel.exe")
select
case $excel=8.0a
$esr="97 SR-1"
case $excel=8.0e
$esr="97 SR-2"
case $excel=9.0.2719
$esr="2000"
case $excel=9.0.3822
$esr="2000 SR-1a"
endselect
$nul = WriteLine(2,$Wrksta + "MS Office Ver is " + $esr + chr(13) +chr(10))
endif
ELSE
$nul = WriteLine(2,$Wrksta + " Not online" + chr(13) +chr(10))
ENDIF
$Wrksta = ReadLine(1)
until @error <> 0
ELSE
?"Wrksta.txt not available!"
EXIT
ENDIF

$nul = Close(2)
:END
$nul = Close(1)
EXIT


Bryce