Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Getting a list of filenames

Dim i as Long, j as Long
Dim FName As Variant
FName = Application.GetOpenFilename( _
"Excel files(*.XLS),*.XLS", Multiselect:=True)
If FName < False Then
j = 0
for i = lbound(Fname) to ubound(FName)
Range("A1").Offset(j,0).Value = fName(i)
Next
Else
MsgBox "User cancelled"
End If

--
Regards,
Tom Ogilvy

"cottage6" wrote in message
...
Hello and HELP!
I'm using the following code to insert the selected filename into a cell.
What I really need is for the user to be able to select multiple files and

to
get those names into some sort of list so the user can select a file from
that group. Is that possible? Remember when giving me a solution that

I'm
not as slick as I could be creating code, so please include explicit
instructions! Thanks.

Dim FName As Variant
FName = Application.GetOpenFilename("Excel files(*.XLS),*.XLS")
If FName < False Then
Range("A1").Select
ActiveCell = FName
Else
MsgBox "User cancelled"
End If



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Getting a list of filenames

do it this way then

Dim i as Long, j as Long
Dim FName As Variant
FName = Application.GetOpenFilename( _
"Excel files(*.XLS),*.XLS", Multiselect:=True)
If isarray(FName) Then
j = 0
for i = lbound(Fname) to ubound(FName)
Range("A1").Offset(j,0).Value = fName(i)
Next
Else
MsgBox "User cancelled"
End If

--
Regards,
Tom Ogilvy


"cottage6" wrote in message
...
Hi Tom, and thanks for the response. I'm getting a "type mismatch" error

on
"If FName < False Then". Can you help?

"Tom Ogilvy" wrote:

Dim i as Long, j as Long
Dim FName As Variant
FName = Application.GetOpenFilename( _
"Excel files(*.XLS),*.XLS", Multiselect:=True)
If FName < False Then
j = 0
for i = lbound(Fname) to ubound(FName)
Range("A1").Offset(j,0).Value = fName(i)
Next
Else
MsgBox "User cancelled"
End If

--
Regards,
Tom Ogilvy

"cottage6" wrote in message
...
Hello and HELP!
I'm using the following code to insert the selected filename into a

cell.
What I really need is for the user to be able to select multiple files

and
to
get those names into some sort of list so the user can select a file

from
that group. Is that possible? Remember when giving me a solution

that
I'm
not as slick as I could be creating code, so please include explicit
instructions! Thanks.

Dim FName As Variant
FName = Application.GetOpenFilename("Excel files(*.XLS),*.XLS")
If FName < False Then
Range("A1").Select
ActiveCell = FName
Else
MsgBox "User cancelled"
End If






  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Getting a list of filenames

Tom,

You forgot to increment j:

j = 0
for i = lbound(Fname) to ubound(FName)
Range("A1").Offset(j,0).Value = fName(i)
j = j + 1
Next

HTH,
Bernie
MS Excel MVP


"Tom Ogilvy" wrote in message
...
do it this way then

Dim i as Long, j as Long
Dim FName As Variant
FName = Application.GetOpenFilename( _
"Excel files(*.XLS),*.XLS", Multiselect:=True)
If isarray(FName) Then
j = 0
for i = lbound(Fname) to ubound(FName)
Range("A1").Offset(j,0).Value = fName(i)
Next
Else
MsgBox "User cancelled"
End If

--
Regards,
Tom Ogilvy


"cottage6" wrote in message
...
Hi Tom, and thanks for the response. I'm getting a "type mismatch"

error
on
"If FName < False Then". Can you help?

"Tom Ogilvy" wrote:

Dim i as Long, j as Long
Dim FName As Variant
FName = Application.GetOpenFilename( _
"Excel files(*.XLS),*.XLS", Multiselect:=True)
If FName < False Then
j = 0
for i = lbound(Fname) to ubound(FName)
Range("A1").Offset(j,0).Value = fName(i)
Next
Else
MsgBox "User cancelled"
End If

--
Regards,
Tom Ogilvy

"cottage6" wrote in message
...
Hello and HELP!
I'm using the following code to insert the selected filename into a

cell.
What I really need is for the user to be able to select multiple

files
and
to
get those names into some sort of list so the user can select a file

from
that group. Is that possible? Remember when giving me a solution

that
I'm
not as slick as I could be creating code, so please include explicit
instructions! Thanks.

Dim FName As Variant
FName = Application.GetOpenFilename("Excel files(*.XLS),*.XLS")
If FName < False Then
Range("A1").Select
ActiveCell = FName
Else
MsgBox "User cancelled"
End If







  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Getting a list of filenames

thanks!

--
Regards,
Tom Ogilvy

"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Tom,

You forgot to increment j:

j = 0
for i = lbound(Fname) to ubound(FName)
Range("A1").Offset(j,0).Value = fName(i)
j = j + 1
Next

HTH,
Bernie
MS Excel MVP


"Tom Ogilvy" wrote in message
...
do it this way then

Dim i as Long, j as Long
Dim FName As Variant
FName = Application.GetOpenFilename( _
"Excel files(*.XLS),*.XLS", Multiselect:=True)
If isarray(FName) Then
j = 0
for i = lbound(Fname) to ubound(FName)
Range("A1").Offset(j,0).Value = fName(i)
Next
Else
MsgBox "User cancelled"
End If

--
Regards,
Tom Ogilvy


"cottage6" wrote in message
...
Hi Tom, and thanks for the response. I'm getting a "type mismatch"

error
on
"If FName < False Then". Can you help?

"Tom Ogilvy" wrote:

Dim i as Long, j as Long
Dim FName As Variant
FName = Application.GetOpenFilename( _
"Excel files(*.XLS),*.XLS", Multiselect:=True)
If FName < False Then
j = 0
for i = lbound(Fname) to ubound(FName)
Range("A1").Offset(j,0).Value = fName(i)
Next
Else
MsgBox "User cancelled"
End If

--
Regards,
Tom Ogilvy

"cottage6" wrote in message
...
Hello and HELP!
I'm using the following code to insert the selected filename into

a
cell.
What I really need is for the user to be able to select multiple

files
and
to
get those names into some sort of list so the user can select a

file
from
that group. Is that possible? Remember when giving me a solution

that
I'm
not as slick as I could be creating code, so please include

explicit
instructions! Thanks.

Dim FName As Variant
FName = Application.GetOpenFilename("Excel

files(*.XLS),*.XLS")
If FName < False Then
Range("A1").Select
ActiveCell = FName
Else
MsgBox "User cancelled"
End If









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
can not scroll on Edit links very long list of filenames Louw Rademeyer SARS Excel Discussion (Misc queries) 1 March 19th 09 12:48 PM
List all filenames & tab names Deeds Excel Worksheet Functions 5 May 18th 06 11:16 PM
Help with a Macro to list all filenames and mod dates in a folder techmoney Excel Programming 3 November 19th 04 09:52 PM
Folder and filenames? Mark[_45_] Excel Programming 6 July 1st 04 03:49 AM
List out FileNames.xls with K4 Blank JMay Excel Programming 4 December 7th 03 04:35 PM


All times are GMT +1. The time now is 02:34 PM.

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

About Us

"It's about Microsoft Excel"