Use word SET in invoke code

I am trying to read a file which has 4,000 line more o less however I dont how to declare the variable which will start reading line by line. I have written the word set but it looks that invoke code doesnt recognize this word, so I declare my variable as object but when I run my project it is shows a error.

I dont use the activity read text file because it doesn’t do anything I think that it is because the file is a little large

You should use plain .Net classes instead of VBA COM objects.
Something like this:

Using sr As StreamReader = File.OpenText(“C:\Users\adrian\Desktop\a.txt”)
Do While sr.Peek() >= 0
Console.WriteLine(sr.ReadLine())
Loop
End Using

Adrian.

2 Likes

Hi @adrian

What is stream reader

it is a .Net class which one can use to work with text files
see:

Adrian.