Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Filter only shortcuts and xl files
"Charles Chickering" wrote in
message .FilterIndex = 2 I'm not entirely sure that I would want to rely on the correct filter being in position 2, especially since Filters can be added and deleted. Instead, I'd probably modify the code I posted earlier to the following: Dim FName With Application.FileDialog(msoFileDialogOpen) .InitialFileName = "%UserProfile%\My Documents" .AllowMultiSelect = False .Filters.Add "Excel File (*.xls)", "*.xls", .Filters.Count + 1 .FilterIndex = .Filters.Count If Not .Show Then .Filters.Delete .Filters.Count Exit Sub End If .Filters.Delete .Filters.Count FName = .SelectedItems(1) End With -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com (email address is on the web site) "Charles Chickering" wrote in message ... Hi Steven, try this: With Application.FileDialog(msoFileDialogOpen) .InitialFileName = "%UserProfile%\My Documents" .AllowMultiSelect = False .FilterIndex = 2 If Not .Show Then Exit Sub FName = .SelectedItems(1) End With -- Charles Chickering "A good example is twice the value of good advice." "Steven" wrote: I have the following code: Private Sub OpenMyDocuments() On Error GoTo ErrMacro Dim FName As String With Application.FileDialog(msoFileDialogOpen) .InitialFileName = "%UserProfile%\My Documents" .AllowMultiSelect = False If Not .Show Then Exit Sub FName = .SelectedItems(1) End With If Len(FName) 0 Then Set wb = Workbooks.Open(FName) End If Application.RecentFiles.Add Name:=FName Windows("Notes.xls").Close (0) ErrMacro: End Sub It shows - All Files (*.*) - in the Files of Type field. How do I make it default to - All Microsoft Office Excel Files - ? Thank you for your help. Steven |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Filter only shortcuts and xl files
I don't believe there is a way to reset the filters, but I must admit I've
never tried. They do get reset when you close the Excel application. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com (email address is on the web site) "Charles Chickering" wrote in message ... That's interesting, is there a way to reset filters after someone has screwed with them? -- Charles Chickering "A good example is twice the value of good advice." "Chip Pearson" wrote: "Charles Chickering" wrote in message .FilterIndex = 2 I'm not entirely sure that I would want to rely on the correct filter being in position 2, especially since Filters can be added and deleted. Instead, I'd probably modify the code I posted earlier to the following: Dim FName With Application.FileDialog(msoFileDialogOpen) .InitialFileName = "%UserProfile%\My Documents" .AllowMultiSelect = False .Filters.Add "Excel File (*.xls)", "*.xls", .Filters.Count + 1 .FilterIndex = .Filters.Count If Not .Show Then .Filters.Delete .Filters.Count Exit Sub End If .Filters.Delete .Filters.Count FName = .SelectedItems(1) End With -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com (email address is on the web site) "Charles Chickering" wrote in message ... Hi Steven, try this: With Application.FileDialog(msoFileDialogOpen) .InitialFileName = "%UserProfile%\My Documents" .AllowMultiSelect = False .FilterIndex = 2 If Not .Show Then Exit Sub FName = .SelectedItems(1) End With -- Charles Chickering "A good example is twice the value of good advice." "Steven" wrote: I have the following code: Private Sub OpenMyDocuments() On Error GoTo ErrMacro Dim FName As String With Application.FileDialog(msoFileDialogOpen) .InitialFileName = "%UserProfile%\My Documents" .AllowMultiSelect = False If Not .Show Then Exit Sub FName = .SelectedItems(1) End With If Len(FName) 0 Then Set wb = Workbooks.Open(FName) End If Application.RecentFiles.Add Name:=FName Windows("Notes.xls").Close (0) ErrMacro: End Sub It shows - All Files (*.*) - in the Files of Type field. How do I make it default to - All Microsoft Office Excel Files - ? Thank you for your help. Steven |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel files on USB -- taskbar shortcuts don't work | Excel Discussion (Misc queries) | |||
How to remove listed shortcuts for deleted Excel files? | Excel Discussion (Misc queries) | |||
all my shortcuts to excel files open up as a picture | Excel Discussion (Misc queries) | |||
Filter only shortcuts and xl files | Excel Programming | |||
shortcuts to excel files. | Excel Programming |