0

sorry to disturb but I'm very new with VBA and not that good at it.

I would like to know if there is a VBA function that allows to open (and read) all the files of a folder (without opening them in Excel) (it's .txt files) ? And if so which one is it ?

Thanks in advance for your answers, I would be very grateful for an answer or some help.

Cheers :)

braX
  • 11,506
  • 5
  • 20
  • 33
Ghita
  • 11
  • 2
  • you say you want to "Open" the files but then say you do not want to open them... – mojo3340 Aug 10 '17 at 08:35
  • sorry, my question was a bit confusing. I have some files in a folder, I want to read them and work on them but without opening them.. – Ghita Aug 10 '17 at 11:42

1 Answers1

2

Here are the basics:

Dim sLine as String
Open "C:\myFile.txt" For Input As #1
Do Until EOF(1)
  Line Input #1, sLine
  ' do some stuff with sLine
Loop
Close #1
braX
  • 11,506
  • 5
  • 20
  • 33