Hi, just joined today, so really please to be here.
Hoping someone can help with my question. I have nearly got it right, but not quite.
I have a userform with1 listbox.
when the form loads, I have the vba macro look for for all .jpg files in a directory given a certain reference from a cell on the worksheet, for example, 12345
This works fine.
MyFolder = Sheets("Main").Range("E15").Value 'I:\pics\
MyFile = Dir(MyFolder & Sheets("Main").Range("E26").Value) 'I:\pics\12345*.jpg
Do While MyFile <> ""
found = found + 1
filelist.AddItem MyFile
MyFile = Dir
Loop
The above is not a problem as long as there is more than 1 file to find. If it doesn't find any files then it's ok, if it finds more than 1 file it's ok, but if there is only 1 file to find it hangs then crashes.
Any ideas please?
Bookmarks