vba FileDIalog.Filters specific kind of filename and sort by created date -
problem: filter out filename include %card%.txt (e.g. xyzcardhij.txt) , listed files in descending order based on created date following code attempted.
sub importdata() dim targetfiledialog office.filedialog set targetfiledialog = application.filedialog(msofiledialogfilepicker) 'open file dialog file path targetfiledialog 'user can imporot 1 file @ time .allowmultiselect = false 'auto direct user specific folder .initialfilename = "desiredpath\" 'add filter .filters.clear .filters.add "all files", "*.txt", 1 if .show = -1 each targetfile in .selecteditems importfile = targetfile next targetfile end if end end sub
Comments
Post a Comment