vba - Macro loop through all files in a folder -
vba - Macro loop through all files in a folder -
im trying macro loop through files in folder , run macro on it. far have:
sub processfiles() dim filename, pathname string dim wb workbook pathname = "c:\trading\tick\probab\data\current\" filename = dir(pathname & "*.xlsm") while filename <> "" workbooks.open (pathname & filename) application.run "storage.xlsm!all" filename = dir() loop end sub
the problem is, after first iteration fails. know sec macro, if take out, files in folder open.
it seems problem related short term memory excel has. macro doing big amount of re-create , pasting , seems somehow prohibiting opening next file.
i solved problem creating new file same macro. working now
vba
Comments
Post a Comment