Loop multiple exports
Robert van den…
Forums
I got like 24 export to excel files, i want to loop the call function with export1, export2 until export 24. When i use the code below i get the result in a message box correct but with the call function i get an error unexpected array. Do i miss something?
Dim Q As String
Dim Func As String
Q = 24
For i = 1 To Q
Func = "Export" & i
'MsgBox Func
Call Func
Client.CloseAll
Client.RefreshFileExplorer
Next i
Hello Robert,
Hello Robert,
Unfortunately you can't use a variable to store a name of a function, you can use it to store the name of a file that gets exported. So you could have a function that does the export and then an array to hold the filenames which are sent through a loop to the export function. Something like this (note I didn't test the code so there could be errors in it):