disabling the Files type combo box

A

areddy

Hi All,


My Visual Basic application is using Excel for reporting.

I need to restrict the users of my application to open only excel files
from
the File->Open dialogue box.

Or

Is there any way to make default ‘Excel files (*.xls)’ in the Files
type
combo box in the Open dialog box and disabling the Files type combo
box, so
that the users can only select excel files when they click File->Open.



Please help me in this regard
 
D

Dave Peterson

I still don't think so.

Even if you force the dialog open with just *.xls types, the user can type:
*.*
in the filename and open whatever they want.

But you could ask for the filename to open, then yell if the extension isn't
..xls.

dim myFileName as variant
myfilename = application.getopenfilename("Excel Files, *.xls")
if myfilename = false then
exit sub 'user hit cancel
end if

if lcase(right(myfilename,4)) <> ".xls" then
msgbox "Nope--only .xls files can be opened!
exit sub
end if
 
Top