• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 46
  • Last Modified:

Access 2010 Pick Path - Filename Options

Hi Experts,

I have the following code for picking a Path / Filename.  It works perfectly.

However it displays the Path Filename Details (Name / Date Modified / Type / Size).  I want it to display only the  Filename/Extension.

What do I need to change to have this occur?

Private Sub BtnFnnnnn_Click()
On Error GoTo STEP_999
'MsgBox "Step 000-Pick Path/File Button Event - F-nn-nnn."
'As Of: 2017/11/29.
'Step Index.
'Step 001-Initialize Common Data.
'Step 100-Select Path And Filename.
'Step 101-Initialize Parameters.
'Step 110-Select Path / Filename.
'Step 119-Clean-up.
'Step 900-Shutdown.
'Step 990-Exit Event.
'Step 999-Form Error Handler Code.

'Parameters.
' Parameter               Description
' .AllowMultiSelect       False = 1 File.  True = Multiple Files.
' .Title Option.          String of Dialog Box Title to be displayed.
' .ButtonName.            String of Dialog Box Selection Button Title to be displayed.
' .Filters.Add            Commented out = No Filters.  Not Commented out, specify Filter Name / string.  e.g. "Documents", "*.doc; *.txt", 1
' .Filters.Add            Add addtional lines for addtional File Types.  Last entry displays first in Dialog Box.
' .InitFileName           Commented out = Last selected.  Specified = Path Starting point.  e.g. .InitialFileName = "M:\"
'  WrkSelectedItem001     Contains the Path / Filename selected.

'Step 001-Initialize Common Data.
Dim FileDialog001 As Office.FileDialog
Dim WrkPath001 As String
Dim WrkPathFilename001 As String
Dim WrkSelectedItem001 As Variant
'Step 100-Select Path And Filename.
'Step 101-Initialize Parameters.
Set FileDialog001 = Application.FileDialog(msoFileDialogFilePicker)
WrkPath001 = Left(Me.FnnnnnPathFilename, InStrRev(Me.FnnnnnPathFilename, "\") - 1) & "\"
'Step 110-Select Path / Filename.
With FileDialog001
   .AllowMultiSelect = False
   .title = "Browse For Import File"
   .ButtonName = "Select Import Path/Filename."
   .Filters.Clear  'Clear File Type Filters if any.
   '.Filters.Add "Documents", "*.txt", 1
   .Filters.Add "Documents", "*.xlsm;*.xls;*.xlsx", 1
   .InitialView = msoFileDialogViewDetails
   .InitialFileName = WrkPath001  'Must be a Path.  i.e. Not Path & Filename.
   If .Show = -1 Then
      For Each WrkSelectedItem001 In .SelectedItems
         WrkPathFilename001 = CStr(WrkSelectedItem001)
      Next WrkSelectedItem001
   Else
      WrkPathFilename001 = Me.FnnnnnPathFilename
   End If
End With
Me.FnnnnnPathFilename = WrkPathFilename001
'Step 119-Clean-up.
Set FileDialog001 = Nothing
STEP_900:
'Step 900-Shutdown.
STEP_990:
'Step 990-Exit Event.
Exit Sub
STEP_999:
'Step 999-Form Error Handler Code.
Dim M00000_999 As Form
Set M00000_999 = [Forms]![M-00-000 - Scout Admin System - Main Menu]
Dim DebugErrMsgOption999 As String
'DebugErrMsgOption999 = "Yes" 'Un-Comment for use.
If DebugErrMsgOption999 = "Yes" Then
   MsgBox Err.DESCRIPTION & " (" & Err.Number & ")"
   Resume STEP_990
Else
   Resume STEP_990
End If
End Sub

Open in new window

Thanks,
Bob C.
0
Bob Collison
Asked:
Bob Collison
  • 7
  • 6
1 Solution
 
Bill PrewCommented:
Try changing:

  .InitialView = msoFileDialogViewDetails

to:

  .InitialView = msoFileDialogViewList


»bp
0
 
Bob CollisonSystem ArchitectAuthor Commented:
Hi Bill,

I will use Code Blocks in the future.

Your solution does only display the Filename/Extension however the Dialog Box Heading displays the Name / Date Modified / Type / Size.

Thanks,
Bob C.
0
 
Bill PrewCommented:
What version of Windows, and Word?

Can you paste a screen capture of that?


»bp
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Bob CollisonSystem ArchitectAuthor Commented:
Hi Bill,

I am attaching the screen capture along with the code updated with your suggestion.

Thanks,
Bob C.
msoFileDialogViewList-option.docx
0
 
Bill PrewCommented:
What version of Windows and Word?
0
 
Bob CollisonSystem ArchitectAuthor Commented:
Hi Bill,

Sorry I forgot them.
- Windows 7 Pro SP1
- MS Office 2010 (Access, Word, Excel, etc.)
Thanks,
Bob C.
0
 
Bill PrewCommented:
Okay, maybe that's just the way it looked "back then", I don't have that config to confirm on here though.

If you open Windows File Explorer, and change the view to List, do you see the column headings there too?


»bp
0
 
Bob CollisonSystem ArchitectAuthor Commented:
Hi Bill,

In my Windows Explored List doesn't have any Column Headings displayed.  Details displays the Column Headings.

Thanks,
Bob C.
0
 
Bill PrewCommented:
Not sure I know how to solve that...

Once you get the file picker dialog box up, if you change the view there with the icon to the top right-ish, to something other than details, do the headers go away?


»bp
0
 
Bob CollisonSystem ArchitectAuthor Commented:
Hi Bill,

In the Dialog Box when I select the 'Options' the 'List' Option is highlighted but the Details Column Headings are displayed.

Regardless of which Option I chose the Details Column Headings stay displayed.

In Windows Explorer all of the Options display correctly.  i.e.  The only one that displays the Column Headings is the Details Option.

I have another code set that also does this and it also always displays the Details Columns so maybe this is Microsoft Bug.

Thanks,
Bob C.
0
 
Bill PrewCommented:
Yes, sounds like perhaps that File Picker Dialog has that "feature" in the version you are running.  You might have to live with it...


»bp
0
 
Bob CollisonSystem ArchitectAuthor Commented:
Hi Bill,

I checked on the version that is in production (different PC but Windows 7 SP1 / Office 2010 including Access 2010) and it works perfectly so it does appear that the PC with the issue has something different.

At this point I don't think that we are going to get any further so I will close the Ticket.

Thanks for all your assistance.  You did answer the original question.

Thanks,
bob C.
0
 
Bill PrewCommented:
Welcome, glad I was able to help.


»bp
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 7
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now