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 - Error importing VideoFileClip from moviepy : AttributeError: 'PermissionError' object has no attribute 'message' -

java - is not an enclosing class / new Intent Cannot Resolve Constructor -

qt - QML MouseArea onWheel event not working properly when inside QML Scrollview -