Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

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
milkyryan
Not applicable

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.