Hello,
I need to:
1) import thousands of XML files with unique filenames from multiple level one subfolders inside parent folder (i.e. Work\xmlDownload\0001\*.xml) to template XLSM file (i.e. Work\institutionInfo.xlsm with customized XML Map),
2) apply data transformation (using query refresh) using Power Query inside this XLSM file,
3) save file as a separate XLS file for each subfolder (i.e. Work\Folder-1.xls),
4) do this for every subfolder inside parent folder (i.e. Work\xmlDownload\0001, Work\xmlDownload\0002, Work\xmlDownload\0003, etc.)
I have managed to create VBA that does everything but since it's based of someone else's code I cannot simplify my result for my modest needs. Currently VBA asks to select next subfolder via folder select dialog and I don't need this:
I need to drop folder selection prompt from this VBA so it just loops through every subfolder of a parent folder (which is in same folder as my template file containing VBA) and does it's thing. However I struggle to do this correctly: after stripping folder selection the VBA cannot find any XML files. Here's my failed take on it:
I can do import of all XML of specified folder but cannot figure out how to inject this to subfolders correctly, i.e. this works as exceted:
I feel I'm missing something really obvious. Please help me out, I'm out of ideas. In case you need my project files for testing (template, folder structure with several XML files), they are in the attachment (institutionInfo.xlsm contains 2 simplified Macro modules, A and B, B is the one that works, A is the one that doesn't work and requires help).
Kind regards,
Imposter
P.S. Testing subfolders for contents works, it looks like relative path of XML files inside of subfolders is the problem.
Cross-posted at www .mrexcel. com/board/threads/1188127/
Bookmarks