this question has answer here:
- loop through files in folder using vba? 5 answers
- batch convert txt xls using vba 1 answer
i have spreadsheet looks through several other spreadsheets in given directory extract statistics them. far, gets first file , hits on , on again.
my code goes this:
public sub getresults() const strdirectory string = "somenetworklocation" dim strfilename string strfilename = dir(strdirectory & "*.xl??") while strfilename <> "" if strfilename "somematchingscheme_##_??" workbooks.open strdirectory & strfilename 'do stuff workbook workbooks(strfilename).close end if loop end sub
any suggestions?
you need call again
strfilename = dir ' no parameters
before loop. call iterate strfilename next file. without it, stick first found file.
Comments
Post a Comment