Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
File Open Dilog Box with Filter
Hi!
I want take user's input for selection of file and for the same I am trying to open File open Dilog Box using the filters (i.e .dbf; .p3; .xls) for the input. I used to do like this but now I am not able to do with same CommonDialog1.Filename = ".P3" CommonDialog1.ShowOpen string1 = Len(CommonDialog1.FileTitle) temp1 = CommonDialog1.Filename dirpath = Mid(temp1, 1, Len(temp1) - string1 - 1) txt_ppath = dirpath txt_network = Left(CommonDialog1.FileTitle, 4) Will you help me how can I do this |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
File Open Dilog Box with Filter
Muk,
I think you are thinking about VB proper, VBA is a little different. You need to use Application..GetOpenFilename( FileFilter, FilterIndex, Title, , MultiSelect) whe FileFilter = A string specifying file filtering criteria. [Optional Variant] ie "Text Files (*.txt),*.txt,Add-In Files (*.xla),*.xla," & _ "Visual Basic Files (*.bas; *.txt),*.bas;*.txt" If omitted, this argument defaults to "All Files (*.*),*.*". FilterIndex = Specifies the index numbers of the default file filtering criteria, from 1 to the number of filters specified in FileFilter. If this argument is omitted or greater than the number of filters present, the first file filter is used. [Optional Variant] Title = Specifies the title of the dialog box. If this argument is omitted, the title is "Open." [Optional Variant] MultiSelect = True to allow multiple file names to be selected. False to allow only one file name to be selected. The default value is False [Optional Variant] Returns the selected file name or the name entered by the user. The returned name may include a path specification. If MultiSelect is True, the return value is an array of the selected file names (even if only one filename is selected). Returns False if the user cancels the dialog box. This method may change the current drive or folder. Example dim vFileToOpen as variant vFileToOpen = Application _ .GetOpenFilename("Text Files (*.txt), *.txt") If fileToOpen < False Then MsgBox "Open " & fileToOpen End If You can then open the file. -- Hope this helps Martin Fishlock Please do not forget to rate this reply. "Muk" wrote: Hi! I want take user's input for selection of file and for the same I am trying to open File open Dilog Box using the filters (i.e .dbf; .p3; .xls) for the input. I used to do like this but now I am not able to do with same CommonDialog1.Filename = ".P3" CommonDialog1.ShowOpen string1 = Len(CommonDialog1.FileTitle) temp1 = CommonDialog1.Filename dirpath = Mid(temp1, 1, Len(temp1) - string1 - 1) txt_ppath = dirpath txt_network = Left(CommonDialog1.FileTitle, 4) Will you help me how can I do this |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
In Excel - Use Windows Explorer instead of File Open to open file | Excel Discussion (Misc queries) | |||
Open a file do a macro ( made) and open next succesive file | Excel Programming | |||
Open File or Switch Between Windows if File is Open | Excel Programming | |||
Open File or Switch Between Windows if File is Open | Excel Programming | |||
Open File Dialog Filter | Excel Programming |