How to highlight multiple files

broken image

Then the three file paths are stored in fpathArray. Suppose we run the Macro and select the below three files, click on Open. Public Sub test()įpathArray = Application.GetOpenFilename(FileFilter:='All Files,*.*', Title:='Select file', MultiSelect:=True) The below Macro allows you to select any file types and allow multiple selection. The default value is FalseĮxample – select multiple files in dialog False to allow only one file name to be selected. True to allow multiple file names to be selected. If this argument is omitted, the title is “Open.” A string specifying file filtering criteria. GetOpenFilename( FileFilter, FilterIndex, Title, ButtonText, MultiSelect) FileFilter Syntax of Application.GetOpenFileName Application. In this post, I will introduce Application.GetOpenFileName. There are different ways you can use to create a dialog to select file, for example, Application.FileDialog, Application.GetOpenFileName. After you select the target file, the file path is stored in a VBA Array, then you can loop through the array to get items, and then do whatever you like with the file. In Excel VBA, you can create a Macro to open the browse dialog. In many applications, you would see a “browse” button where you can select files for the application to process. This Excel VBA tutorial explains how to select multiple files in dialog using Application.GetOpenFileName.