First take a look at the cFileetensions parameter description in the help, you can offer the dialog to initialize with all these options for the user: X=Getfile('xls,xlsx,xlsm,xlsb',...)
And then after the selection you can get the file extension of the selected file with JUSTEXT(X). Take a look at the whole family of JUST...().
X = Getfile('xls', 'Please Select The XL File ', 'Browse')
IF NOT EMPTY(X)
IF INLIST(UPPER(JUSTEXT(X)), "XLS", "XLSX", "XLSM", "XLSB"))
* File type OK
ELSE
* Not OK
ENDIF
ELSE
* User cancelled
ENDIF
[highlight #FCE94F]EDIT: There was a syntax error in my INLIST() above. Now corrected. Apologies.
Mike[/highlight]
__________________________________
Mike Lewis (Edinburgh, Scotland)
As things stand, your GETFILE() will only display those files whose extension is XLS - not XLSX, etc. The user will still be able to select "All files (*.*)" under "Files of Type" but they might not know they need to do that. A better option might be:
[tt]GETFILE("XLS, XLSX, XLSM, XLSB")[/tt]
But you would still need to check that they have selected the right file type. Modifying GETFILE() in this way only alters the files they see; it does not prevent them from selecting other files.
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.