Create file name in a loop

Hello, everybody,
Excel files are created in my loop, then I save them as
Directory.GetCurrentDirectory + "\ Data " + “\ B1.xls”
But I need each file to grow by 1 so that the next name is B2, then B3, and so on.
Tell me how to do it

when the loop is realized within a for each then we can use the index output:
grafik

Path.Combine(Directory.GetCurrentDirectory,“Data”, “B” & (idx + 1).toString & ".xls”)

when loop is realized different then create a counter variable, used it similar and increase the counter within each loop

1 Like

Thank you!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.