Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello from Australia,
I am new to this Newsgroup and fairly new to Excel programming as well, but the opportunity to talk to such a newsgroup looks very hopeful indeed. My problem is in trying to obtain the names of a group of files and use them in a program. Using: fName = Application.GetOpenFilename("DAT files(*.dat), *.dat", 1, "Select DAT files", , False) the last parameter, "False", indicates a single selection and it is stored in "fName", which I can use in a statement such as: MsgBox "File(s): " & fName This works ok. What is the form of the statement for multiple files? i.e.: fName = Application.GetOpenFilename("DAT files(*.dat), *.dat", 1, "Select DAT files", , True) Last parameter is "True". Does "fName" have to be declared as an array of strings? How can I access all the filenames from this multiple selection? Thanks in advance for any help. John. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi John,
Good day, from Japan. :-) The argument for multiple files is as you wrote, TRUE. And regarding to a variable type, please declare fName As Variant. When you select multiple files, it can store the file names as an array. And you can judge, if the variable fName has value with "VarType" as follows. Code: -------------------- Sub Macro1() Dim fName As Variant Dim f As Variant fName = Application.GetOpenFilename("DAT files(*.dat),*.dat", 1, "Select DAT files", , True) If VarType(fName) = 11 Then Exit Sub For Each f In fName MsgBox Dir(f) Next End Sub -------------------- --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
excel files in my docs have numbered filenames and are duplicates | Setting up and Configuration of Excel | |||
Acquiring External Data | Excel Discussion (Misc queries) | |||
using wildcard characters for filenames in externally linked files | Excel Discussion (Misc queries) | |||
Using GetOpenFilename | Excel Programming | |||
GetOpenFilename | Excel Programming |