Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot Open download with file extension .xls rancheo Excel Discussion (Misc queries) 1 September 16th 08 10:32 PM
how to open a file with .rar extension RaY Excel Discussion (Misc queries) 2 February 12th 07 09:43 AM
how to open a file with .rar extension RaY Excel Discussion (Misc queries) 1 February 12th 07 08:31 AM
how i open a file XLS extension[ exelspreadsheet file] how to open a excel spreedsheet file Excel Worksheet Functions 1 July 25th 05 01:48 PM
Open Excel file on a remote server Adam[_9_] Excel Programming 3 April 29th 04 10:45 PM


All times are GMT +1. The time now is 01:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"