Below you can read the problematic part of my VBA macro code. I try to loop through all files in a folder. When I run the code, it does not open anything, instead, it returns "runtime error 1004", it can not find the file. The interesting thing is, that it displays the name of the file precisely. I did check, the file is in the correct folder, extension, name, everything is correct. What is more, the file name was found by the Dir function, not typed by me, which makes it complete nonsense to me. I introduced a message box line before the open command and it displayed the exact name of the first file of the folder looped through.
ControlFile = Dir(ControlFolder & "\", vbReadOnly)
Do While ControlFile <> ""
Workbooks.Open (ControlFile)
ControlFile = Dir
Loop
Ferenc