If I know the path to my folder, how can I retrieve the name of a file it contains if I don't know the filename before hand please?
Printable View
If I know the path to my folder, how can I retrieve the name of a file it contains if I don't know the filename before hand please?
if VB6, then one option would be to do something like(if there's just one file in the folder that is.)VB Code:
Private Sub Command1_Click() Dim sPath As String sPath = "C:\Path\To\File\" Debug.Print Dir(sPath & "*.*") End Sub
Yes it's VB6 and yes there should only by 1 file.
Thats most helpful, thanks a lot :thumb: