ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   disabling the Files type combo box (https://www.excelbanter.com/excel-discussion-misc-queries/51161-disabling-files-type-combo-box.html)

areddy

disabling the Files type combo box
 

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


--
areddy
------------------------------------------------------------------------
areddy's Profile: http://www.excelforum.com/member.php...o&userid=28204
View this thread: http://www.excelforum.com/showthread...hreadid=477439


Dave Peterson

disabling the Files type combo box
 
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



areddy wrote:

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

--
areddy
------------------------------------------------------------------------
areddy's Profile: http://www.excelforum.com/member.php...o&userid=28204
View this thread: http://www.excelforum.com/showthread...hreadid=477439


--

Dave Peterson


All times are GMT +1. The time now is 10:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com