PDA

View Full Version : Opening files in a folder with a certain word in filename



JZB
11-22-2010, 09:00 AM
Hi Guys

Can you confirm how i can count the number files in a folder that contain a certain word. in this case 'end'.

I assume its using the instr logic? sorry not sure about this one:dunno

Thanks

Jon

Bob Phillips
11-22-2010, 09:29 AM
Dim cnt As Long
Dim filename As String

filename = Dir("<directory name>\*end*")
Do While filename <> ""

cnt = cnt + 1
filename = Dir
Loop

MsgBox cnt