Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default Acquiring filenames for multiple files with GetOpenFilename

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Acquiring filenames for multiple files with GetOpenFilename

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
excel files in my docs have numbered filenames and are duplicates sss Setting up and Configuration of Excel 1 December 11th 07 11:37 PM
Acquiring External Data charles Excel Discussion (Misc queries) 1 July 10th 06 06:40 PM
using wildcard characters for filenames in externally linked files Harold Good Excel Discussion (Misc queries) 0 June 27th 06 03:40 AM
Using GetOpenFilename Robin Seaby Excel Programming 2 August 6th 03 04:50 PM
GetOpenFilename Daniel[_4_] Excel Programming 3 July 27th 03 11:00 AM


All times are GMT +1. The time now is 06:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"