.Title = "Please select one or more files" ' Clear out the current filters, and add our own. The property takes a single argument, DialogType, that determines the type of FileDialog object that the property returns. Using the FileDialog object. In VBA fieldialog is a property which is used to represent different instances, in filedialog there are four different types of constants which are known as msofiledialogfilepicker which is used to select a file from a given path second one is msofiledialogfolderpicker which name suggests is used to pick a folder and third is msofiledialog open to open a file and the last is msofiledialogsaveas which is used to save a … Yet, instead of picking through a multitude of directories, I would like to set the path in which the files are always located and the file type, e.g., .xls, .xlsx, .mdb. Windows FileDialog to Select File or Folder Path in VBA Dear friends, In my many of the Excel Tools, wherever there is a need of file path to be entered from your local PC, I try to put a browse button to locate that file in your Windows PC through windows file explorer window. It is very easy to do this. Find answers to Default Directory for File Dialog Box from the expert community at Experts Exchange ... (msoFileDialogFilePicker) Dim selectedfile As String With fd.InitialFileName = "c: ... strStart = currdir ' or strStart = ActiveWorkbook.Path With fd.InitialFileName = strStart. Your other alternative is to implement the API code I provided. Just let me know. By default, this property is set to the standard text for the type of file dialog box. CurrDir gives you the current active folder in windows, or activeworkbook.path is the location of the active workbook (blank if it's not saved). strStart = currdir ' or strStart = ActiveWorkbook.Path With fd.InitialFileName = strStart. ... Set fd = Application.FileDialog(msoFileDialogFilePicker) 'Declare a variable to contain the path 'of each selected item. You can eliminate that portion of the code altogether and "hard-code" your path to the file instead. Sub abc() Set diaFolder = Application.FileDialog(msoFileDialogFolderPicker) diaFolder.AllowMultiSelect = False diaFolder.Title = "Select a folder then hit OK" Dim status As Integer status = diaFolder.Show If status <> -1 Then MsgBox "Cancel Chosen" Exit Sub End If a = diaFolder.SelectedItems(1) MsgBox ("Folder selected is :" & a) End Sub Even though the path is aString, 'the variable must be a Variant because For Each...Next 'routines only work with Variants and Objects I am using this - Set fd = Application.FileDialog(msoFileDialogFilePicker) in a program for the user to get a file to import.

If you don't understand how to do it I'll be happy to modify the code for you. You would then need to make sure the file to process is always put into the same directory. .accdb, etc. Select all Open in new window. Set fDialog = Application.FileDialog(msoFileDialogFilePicker) With fDialog ' Allow user to make multiple selections in dialog box .AllowMultiSelect = True ' Set the title of the dialog box. As Martin says, there could be other definitions of current directory, but I think these are the most likely andrewssd3. Learn more Default values of path variables in windows 10 [closed] Set fDialog = Application.FileDialog(msoFileDialogFilePicker) With fDialog ' Allow user to make multiple selections in dialog box.AllowMultiSelect = True ' Set the title of the dialog box..Title = "Please select one or more files" ' Clear out the current filters, and add our …