ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to disable files type combo box in Open Dialog box (https://www.excelbanter.com/excel-programming/343201-how-disable-files-type-combo-box-open-dialog-box.html)

ourspt

How to disable files type combo box in Open Dialog 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.
--
ourspt

Arvi Laanemets

How to disable files type combo box in Open Dialog box
 
Hi


....
' Asking for file name
Const fTitle = "Select File!"
Const FilterList = "Templates (*.XLS), *.XLS"
fFullName = Application.GetOpenFilename(Title:=fTitle,
FileFilter:=FilterList)
If fFullName = "False" Then
MsgBox ("No file to open!")
ActiveWindow.Close
Exit Sub
End If
....


Arvi Laanemets


"ourspt" wrote in message
...
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.
--
ourspt




Kaak[_34_]

How to disable files type combo box in Open Dialog box
 

You can disable the file menu

and let the user select a file through a function you write like this

Function GetImportFileName()

Dim Filt As String
Dim FilterIndex As Integer
Dim FilaName As Variant
Dim Title As String
Dim i As Integer
Dim Msg As String

Filt = "Text Files (*.txt),*.txt," & _
"Lotus Files (*.prn),*.prn," & _
"ASCII Files (*.asc),*.asc," & _
"All Files (*.*),*.*,"

FilterIndex = 4

Title = "Select a File to Import"

Filename = Application.GetOpenFilename( _
FileFilter:=Filt, _
FilterIndex:=FilterIndex, _
Title:=Title, _
MultiSelect:=False _
)
If Filename = "False" Then

MsgBox "No file was selected."
Exit Function

End If

GetImportFileName = Filename

End Function

kaak


--
Kaak
------------------------------------------------------------------------
Kaak's Profile: http://www.excelforum.com/member.php...fo&userid=7513
View this thread: http://www.excelforum.com/showthread...hreadid=477437


Dave Peterson

How to disable files type combo box in Open Dialog box
 
You've gotten other replies to your other posts, too.

ourspt 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.
--
ourspt


--

Dave Peterson


All times are GMT +1. The time now is 02:15 PM.

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