Is there any trick to get Filename field in the Open file dialog filled with a default filename when called with a Getopenfilename statement? Thanks, Stefi Hi, Here's the method I would use. Sub Default_Name() Dim MyPath As String Dim MyFile As String MyPath = 'G: Backup ' 'Change to suit With Application.FileDialog(msoFileDialogFilePicker).InitialFileName = MyPath & 'BookTest.xls'.Show MyFile =.SelectedItems(1) End With Workbooks. Effective Ball Handling Program 2.0. Open Filename:=MyFile End Sub If this response answers your question then please mark as answer.
Code: RunBookCrtF = Application.GetOpenFilename('Runbook file in YYYY-MM-DD format (*.xlsx),*.xlsx', 1, 'Select latest date Runbook Critical Fields Report file')This will prompt the user to open one workbook which is required for executing a macro. When this file open dialog box appears on screen it is displaying 4-5 different filenames in default folder under which this dialogbox is displayed. My requirement is it should display only filename starting with 20*.xlsx because the file I want the user should open is in YYYY-MM-DD.xlsx format and it can be any date from this week ex. This way I can prevent user from selecting a wrong file to be opened. Is that possible to apply this kind of filter?
Feb 8, 2017 - How often in your VBA code do you have ask for a file name along with its complete path as an input from the user? Well it's possible using the getopenfilename method. FilterIndex: Specifies the index numbers of the default file filtering criteria, from 1 to the number of filters specified in FileFilter. Displays the File Open dialog box. Update links with alternate path. IgLinksUpdateWithDefpath, Update links with default path. IgNoLinksUpdate, Do not update links. Member of the DocumentAccess constant set that specifies the read-write access by which the specified document should be opened. 6 days ago - GetOpenFileName. Download Opera Mini 7 Java 128x160. Can be used to obtain a valid filename and its full path. This method displays the Open dialog box but will not actually open the file. This method will. FilterIndex - This specifies which file filter is the default. Not required if. GetOpenFileName(FileFilter:='Excel Files (*.xlsx),*.xlsx', _.