G
Guest
Code------------------->
Private Sub btnBrowse_Click()
' This requires a reference to the Microsoft Office 11.0 Object Library.
Dim fDialog As Office.FileDialog
Dim varFile As Variant
Dim fs As Office.FileSearch
Dim cboFolder As String
' Clear the list box contents.
Me.FileList.RowSource = ""
' Set up the File dialog box.
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
Set fs = Application.FileSearch
With fs
.LookIn = "S:\TracerNotes_OBR\OBR_RESOURCES_DB_PROJECT\"
End With
' Allow the user to make multiple selections in the dialog box.
.AllowMultiSelect = False
' Set the title of the dialog box.
.Title = "Select One or More Files"
' Clear out the current filters, and then add your own.
.Filters.Clear
.Filters.Add "Excel Spreadsheets", "*.XLS"
.Filters.Add "All Files", "*.*"
' Show the dialog box. If the .Show method returns True, the
' user picked at least one file. If the .Show method returns
' False, the user clicked Cancel.
If .Show = True Then
' Loop through each file that is selected and then add it to the
list box.
For Each varFile In .SelectedItems
Me.FileList.AddItem varFile
Next
Else
'MsgBox "You clicked Cancel in the file dialog box."
End If
End With
End Sub
Code-------------------->
this is the code I found on the microsoft website for making a browse button
work in Access 2003. What I would like to know is what code do you use to
select the default directory that the open window appears in? As you can see,
I tried the .lookin statement but it said that that isn't in the fdialog
"scope"
tia.
Private Sub btnBrowse_Click()
' This requires a reference to the Microsoft Office 11.0 Object Library.
Dim fDialog As Office.FileDialog
Dim varFile As Variant
Dim fs As Office.FileSearch
Dim cboFolder As String
' Clear the list box contents.
Me.FileList.RowSource = ""
' Set up the File dialog box.
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
Set fs = Application.FileSearch
With fs
.LookIn = "S:\TracerNotes_OBR\OBR_RESOURCES_DB_PROJECT\"
End With
' Allow the user to make multiple selections in the dialog box.
.AllowMultiSelect = False
' Set the title of the dialog box.
.Title = "Select One or More Files"
' Clear out the current filters, and then add your own.
.Filters.Clear
.Filters.Add "Excel Spreadsheets", "*.XLS"
.Filters.Add "All Files", "*.*"
' Show the dialog box. If the .Show method returns True, the
' user picked at least one file. If the .Show method returns
' False, the user clicked Cancel.
If .Show = True Then
' Loop through each file that is selected and then add it to the
list box.
For Each varFile In .SelectedItems
Me.FileList.AddItem varFile
Next
Else
'MsgBox "You clicked Cancel in the file dialog box."
End If
End With
End Sub
Code-------------------->
this is the code I found on the microsoft website for making a browse button
work in Access 2003. What I would like to know is what code do you use to
select the default directory that the open window appears in? As you can see,
I tried the .lookin statement but it said that that isn't in the fdialog
"scope"
tia.