![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
|
Hi All, I have the following code under a button click. The dialog opens to display the "My Documents" folder. My question is how can I change it to open at some other user specified folder, i.e., C:\Temp ? Thanks. Dim varReturn As Variant Dim varFile As Variant Dim strDBDir As String Dim strMsg As String Dim db As Database Dim varFileName As Variant Dim tdf As TableDef Dim intI As Integer Dim intNumTables As Integer Dim strProcName As String Dim strFilter As String Dim lngFlags As Long Dim adhVerifyLinks As Boolean Dim fDialog As Office.FileDialog 'Set up the File Dialog. Set fDialog = Application.FileDialog(msoFileDialogFilePicker) With fDialog 'Allow user to make multiple selections in dialog box. .AllowMultiSelect = False 'Set the title of the dialog box. .Title = "Please select one Access Database file" 'Clear out the current filters, and add our own. .Filters.Clear .Filters.Add "Access Databases", "*.MDB; *.ACCDB" '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 selected and add it to the list box. For Each varFile In .SelectedItems varFileName = varFile Next Else 'MsgBox "You clicked Cancel in the file dialog box." Exit Sub End If End With |
#4
| |||
| |||
|
|
Hi Barry, *I use the Microsoft Office Library for OpenFileDialog -- as follows: Private Sub Command1_Click() * *Dim v As Variant * *Dim f As FileDialog * *'--make a reference to: *Microsoft Office 11.0 Object * *'--Library (or whatever Office version is current) * *Set f = Application.FileDialog(msoFileDialogOpen) * *f.Filters.Add "Text Documents", "*.txt" * *f.InitialFileName = "C:\1C" * *f.Show * *For Each v In f.SelectedItems * * * Debug.Print v * *Next End Sub Rich *** Sent via Developersdexhttp://www.developersdex.com*** |
![]() |
| Thread Tools | |
| Display Modes | |
| |