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

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -