Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

How do I loop through all files in a folder in a macro?

Hi,

I have a macro that I want to run for every file in a particular folder.

i.e. At the moment I have

Sub Macro ()

     (Macro code)

End Sub

I want something along the lines of:

Sub Macro ()

     Set folder = 'C:\TEMP\'

     For each file in folder

          (Macro code)

     Next file

End Sub

What's the correct code I should be putting in to get it doing the rest of my code for each file in the folder?

Thanks,

Neil

1 Reply
Partner
Partner

Re: How do I loop through all files in a folder in a macro?

Hi Griffin,

Not sure if you're still working on this but I found Michael Anthony's solution on the below thread to be very helpful.

search for filenames in a directory within a macro

I used this loop to convert XML to Excel XLS format for all files in a folder, I trust you'll also find this to be very useful.

Thanks,

Ryan.