Read txt file for input error handler

  • Thread starter Thread starter Chirs
  • Start date Start date
C

Chirs

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
 
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



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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top