Dear All
I’m trying to use the FileSearch model to give me a list of files in a specific directory, the idea being to allow the user to select one specific file for further use. The code I’m using is below, it’s a simplified version of the example in the Access Developers handbook by Getz et al. I realise there are a few sub and private procedures called in the examples they use that aren’t well documented and I’m guessing I’m missing something critical from one of them, but what it is I can’t work out.
The last error mesage was about the object not being set, but set to what??
Private Sub mlstFoundFiles_Enter()
Dim File As Variant
Dim mlstFoundFiles As MSForms.ListBox
Set mlstFoundFiles = ??????????? (here because the last error message I got was that the object wasn’t Set, but I’ve no idea what it should be set to???)
With Application.FileSearch
.NewSearch
.LookIn = “C:”
.FileName = “*.*”
.SearchSubFolders = False
.Execute
For Each File In .FoundFiles
mlstFoundFiles.AddItem File
Next File
End With
End Sub
So, I hurl myself on your mercy and ingenuity yet again.
Thanks in advance.
Ian