Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default directory listing in listbox

I have a little experience manipulating data in Excel using VBA, but no
experience with userforms. Is there a relatively simple way to fill a listbox
with the contents of a folder so the user can be presented with a choice of
files that will be used for some calculations? Goal is for user to select a
file from the list box, then the VBA code will pull certain data out of that
file for a calculation.

Thanks,
Rob
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default directory listing in listbox

hi,
see this site.
http://j-walk.com/ss/excel/tips/tip29.htm

regards
FSt1

"br549" wrote:

I have a little experience manipulating data in Excel using VBA, but no
experience with userforms. Is there a relatively simple way to fill a listbox
with the contents of a folder so the user can be presented with a choice of
files that will be used for some calculations? Goal is for user to select a
file from the list box, then the VBA code will pull certain data out of that
file for a calculation.

Thanks,
Rob

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default directory listing in listbox

The instructions at the referenced site are beyond my skills to understand.
It seems to be creating a custom function (something else I'm not familiar
with). Its not clear to me how I use this to get a filename to work with. If
there is not a simpler method I'll end up manually typing filenames to get
the data I need. Thanks for the reference though; maybe someday I will
figure it out.

"FSt1" wrote:

hi,
see this site.
http://j-walk.com/ss/excel/tips/tip29.htm

regards
FSt1

"br549" wrote:

I have a little experience manipulating data in Excel using VBA, but no
experience with userforms. Is there a relatively simple way to fill a listbox
with the contents of a folder so the user can be presented with a choice of
files that will be used for some calculations? Goal is for user to select a
file from the list box, then the VBA code will pull certain data out of that
file for a calculation.

Thanks,
Rob

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 284
Default directory listing in listbox

Rob,

Is your plan to have the list of files available as soon as the userform is
activated or is the user going to do something else that will trigger the
listbox update (for example, selecting the folder where the files are)?

Is the user only going to be presented files in the folder or might there be
subfolders as well?

Steve Yandl


"br549" wrote in message
...
I have a little experience manipulating data in Excel using VBA, but no
experience with userforms. Is there a relatively simple way to fill a
listbox
with the contents of a folder so the user can be presented with a choice
of
files that will be used for some calculations? Goal is for user to select
a
file from the list box, then the VBA code will pull certain data out of
that
file for a calculation.

Thanks,
Rob



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default directory listing in listbox

I finally found a solution that I could make work:

Sub PickFiles()
Dim lngCount As Long
' Open the file dialog
With Application.FileDialog(msoFileDialogOpen)
.AllowMultiSelect = True
.Show
' Display paths of each file selected
For lngCount = 1 To .SelectedItems.Count
Worksheets("FileSelection").Select
Cells(lngCount + 8, 6).Value = .SelectedItems(lngCount)
Next lngCount
End With
End Sub

The user clicks a button that I assigned to this macro. Might not be a very
elegant solution, but works well enough for my application.
Thanks for the suggestions,
Rob

"Steve Yandl" wrote:

Rob,

Is your plan to have the list of files available as soon as the userform is
activated or is the user going to do something else that will trigger the
listbox update (for example, selecting the folder where the files are)?

Is the user only going to be presented files in the folder or might there be
subfolders as well?

Steve Yandl


"br549" wrote in message
...
I have a little experience manipulating data in Excel using VBA, but no
experience with userforms. Is there a relatively simple way to fill a
listbox
with the contents of a folder so the user can be presented with a choice
of
files that will be used for some calculations? Goal is for user to select
a
file from the list box, then the VBA code will pull certain data out of
that
file for a calculation.

Thanks,
Rob




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
directory listing [email protected] Excel Programming 7 February 9th 07 06:43 PM
FTP Directory Listing GerbilGod7[_9_] Excel Programming 2 May 17th 06 04:53 PM
Directory listing Bampah Excel Discussion (Misc queries) 4 January 19th 06 03:25 PM
Directory listing Nigel Chapman Excel Discussion (Misc queries) 2 April 15th 05 02:52 PM
Recursive directory listing Jim[_47_] Excel Programming 2 September 16th 04 10:55 PM


All times are GMT +1. The time now is 02:58 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"