Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
When the MultiSelect parameter is True, GetOpenFileName returns an
array, even if a single file is selected. First, test the result to see if it is an array. If it is, then one or more files were selected. If it is not an array, then the user cancelled the operation. For example, Dim FileNames As Variant Dim N As Long FileNames = Application.GetOpenFilename( _ filefilter:="Text Files (*.txt),*.txt", _ MultiSelect:=True) If IsArray(FileNames) Then ' were files selected? ' loop through array of file names For N = LBound(FileNames) To UBound(FileNames) Cells(N, 1).Value = FileNames(N) Next N Else ' user cancelled the operation Debug.Print "user cancellled" End If Cordially, Chip Pearson Microsoft Most Valuable Professional Excel Product Group, 1998 - 2009 Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Mon, 9 Mar 2009 00:34:00 -0700, ??? wrote: Hi all! I am using the Application.GetOpenFilaName procedure in order the get the path of files. if it is in a MultiSelect mode the pathes are an array. I tried to copy them to a worksheet but i got only the last path. Is it posible to get all the pathes each one in a separate cell? FileName = Application.GetOpenFilename(FileFilter:="Text File (*.txt),*.txt", MultiSelect:=True) Range("A1").Value = FileName Thanks in advance Eli |