View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Andibevan[_2_] Andibevan[_2_] is offline
external usenet poster
 
Posts: 128
Default Read txt file for input error handler

Hi Chris,

The following bit of code will open the file that is assigned to loopcnt.
It will then loop through every line in the txt file moving the data to a
seperate row on the worksheet.

You could modify this in order to read your error file maybe depending on
whether your error file contains 1 line or multiple lines.

Ta

Andi

Loopcnt = "c:\doc.txt"

Open Var_JrnlFile(Loopcnt) _

For Input As #Loopcnt

r = 0


Do Until EOF(Loopcnt) 'do until end of file #1 is reached

Line Input #Loopcnt, data


ActiveCell.Offset(r, 0) = data

r = r + 1


Loop


'MsgBox (Var_JrnlFile(Loopcnt))



Close #Loopcnt



"Chirs" wrote in message
oups.com...
Hello,

I have a problem reading a text file. My VBA script calls a perl
script, VBA keep searching for a flag.txt so he don't go further with
the macro while perl is running.

What i want is that perl reports his errors in flag.txt (this is
working), and that VBA read the error as input for his error handler.

I have tried several thing but i can get it running. Have someone an
idea? what options do i have to use etc. etc. ??

Allready Thanks for your reply Chris