excel vba - VBA Open file with wildcard knowing only extension -


i trying excel open file in given folder (thisworkbook.path\peach\apple) has .xlsm extension (there 1 file). possible open wildcard character? not know name of file, extension.

if not, there way it?

just ask file system first matching file:

dim path string: path = thisworkbook.path & "\peach\apple\"  findfirstfile = dir$(path & "*.xlsm")  if (findfirstfile <> "")     workbooks.open path & findfirstfile else    '// not found end if 

(this not search sub-directories)


Comments

Popular posts from this blog

c++ - CPP, 'X' button listener -

shared memory - gstreamer shmsrc and shmsink with h264 data -

.net - Bulk insert via Dapper is slower than inserting rows one-by-one -