![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: Wisconsin - USA
Posts: 62
|
I have a need to use the GetOpenFileName method, to select a file.
The default directory where the files are stored have different names.... 123_ABC.txt 333_ABC.txt 999_WYZ.txt I can use the FileFilter property to narrow down *.txt files. But I need to only display the _ABC.txt files. I can get it to work only manually through the dialog...i.e. type in: 'ABC.txt' should filter the list in the dialog to: 123_ABC.txt & 333_ABC.txt Does anyone know how to programatically match the file name just like the "File name" option in the dialog box itself? The provided example via this link did not work: http://mrexcel.com/board/viewtopic.p...c=6480&forum=2 When we run it, we see the following in the Files of Type drop-down list: my Files(*_ABC.txt.*) We also tried it without the last ".", but it just displayed: my Files(*_ABC.txt*) However, no files defined of that type display. Any suggestions would be great. Perhaps this filter should be applied to the "File Name" entry box instead? |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Your file filter needs to be defined as;
sFilter = "my Files (*ABC.txt)" & Chr(0) & "*ABC.txt" & Chr(0) |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Location: Wisconsin - USA
Posts: 62
|
Thanks Ivan!
That worked! Have a super day! |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|