Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
filter file extension on remote pc for file open
Hi,
I'm using the code below to select a certain log file on a remote PC. ------------------------------------------ frmSelectKast.Show If CancelSelect = 1 Then Exit Sub With Application.FileDialog(msoFileDialogOpen) If HassKast = 1 Then .InitialFileName = "\\Kndclt21079\barcoview\Bvw_DMT \bvw_av_prog\Bin\Logs" 'FMT LOG files kast 1 !!! .Title = "FMT LOG files kast 1" Else .InitialFileName = "\\Kndclt21063\logs" 'FMT LOG files kast 2 !!! .Title = "FMT LOG files kast 2" End If .Filters.Add "FMT LOG files", "*.log", 1 .FilterIndex = 1 .AllowMultiSelect = False .InitialView = msoFileDialogViewDetails .Show If .SelectedItems.Count = 0 Then Exit Sub FName = .SelectedItems(1) End With ------------------------------- The idea is to select only the *.log files on the remote PC Thats why i use following lines in the code: .Filters.Add "FMT LOG files", "*.log", 1 .FilterIndex = 1 But if my dialog opens up there appears an other type of file in the "Files of type " textbox. I expect that the *.log would be the first (and only?) kind of files that would be visible. What is going wrong here? Any help welcome regards, Ludo |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
filter file extension on remote pc for file open
I set a property to the dialog object to make it easier to debug. I got only
one entry. I'm thinking you may need to clear the filters before adding a new one. See code below. Set Mydialog = Application.FileDialog(msoFileDialogOpen) With Mydialog .InitialFileName = "\\XYZ" .Title = "FMT LOG files kast 1" .Filters.Clear .Filters.Add "FMT LOG files", "*.log", 1 .FilterIndex = 1 .AllowMultiSelect = False .InitialView = msoFileDialogViewDetails .Show If .SelectedItems.Count = 0 Then Exit Sub FName = .SelectedItems(1) End With "Ludo" wrote: Hi, I'm using the code below to select a certain log file on a remote PC. ------------------------------------------ frmSelectKast.Show If CancelSelect = 1 Then Exit Sub With Application.FileDialog(msoFileDialogOpen) If HassKast = 1 Then .InitialFileName = "\\Kndclt21079\barcoview\Bvw_DMT \bvw_av_prog\Bin\Logs" 'FMT LOG files kast 1 !!! .Title = "FMT LOG files kast 1" Else .InitialFileName = "\\Kndclt21063\logs" 'FMT LOG files kast 2 !!! .Title = "FMT LOG files kast 2" End If .Filters.Add "FMT LOG files", "*.log", 1 .FilterIndex = 1 .AllowMultiSelect = False .InitialView = msoFileDialogViewDetails .Show If .SelectedItems.Count = 0 Then Exit Sub FName = .SelectedItems(1) End With ------------------------------- The idea is to select only the *.log files on the remote PC Thats why i use following lines in the code: .Filters.Add "FMT LOG files", "*.log", 1 .FilterIndex = 1 But if my dialog opens up there appears an other type of file in the "Files of type " textbox. I expect that the *.log would be the first (and only?) kind of files that would be visible. What is going wrong here? Any help welcome regards, Ludo |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Cannot Open download with file extension .xls | Excel Discussion (Misc queries) | |||
how to open a file with .rar extension | Excel Discussion (Misc queries) | |||
how to open a file with .rar extension | Excel Discussion (Misc queries) | |||
how i open a file XLS extension[ exelspreadsheet file] | Excel Worksheet Functions | |||
Open Excel file on a remote server | Excel Programming |