DIGIT-ARC read-only archive · snapshot: July 23, 2026

need help with VBA

2 posts · originally from https://geek.digit.in/community/threads/need-help-with-vba.146192/

A
arian29 Original post #1
Sep 8, 2011 at 1:34 PM
I need a code in vba which would read a file name in a specified folder (dynamic path). the file name changes every time and there can be more than one files and the code should pick them all. The file is recognised by a word say "QWE" which exists in the file name everytime. e.g. E2 QWE T556M.XLSX etc... :???:
asingh
asingh #2
Sep 8, 2011 at 4:12 PM
Sub Open_Files()
'//files are opened from here...and processed for raw data

Dim crnt_prj_pth As String
Dim fl_nm As String

fl_nm = Dir(crnt_prj_pth & "\" & "*.CSV") '//.CSV wildcard is being used here


Do While fl_nm <> "" '//master LOOP

'//intermediate processing

fl_nm = Dir

Loop

End Sub

This will cycle through the directory path which you assign to the variable "crnt_prj_pth".