Class module to load filenames into a listbox

J

JDB

Does anyone point me to a class module to load filenames into a list
box so they can be selected for use within the VBA??

thanks

JDB
 
S

Stuart McCall

JDB said:
Does anyone point me to a class module to load filenames into a list
box so they can be selected for use within the VBA??

thanks

JDB

This

http://www.smccall.demon.co.uk/Downloads.htm#FsRecurse

will scan a specific path, either recursively (including subfolders) or not.
The demo fills a textbox, but all it needs to change to filling a listbox is
to change the event procedure fs_FileFound to something like:

Me.ListBoxName.AddItem FileName
 
S

Stuart McCall

JDB said:
Does anyone point me to a class module to load filenames into a list
box so they can be selected for use within the VBA??

thanks

JDB

This

http://www.smccall.demon.co.uk/Downloads.htm#FsRecurse

will scan a specific path, either recursively (including subfolders) or not.
The demo fills a textbox, but all it needs to change to filling a listbox is
to change the event procedure fs_FileFound to something like:

Me.ListBoxName.AddItem FileName
 
A

abkad

Thank you this question is helpful for me but how can I change the event
procedure fs_FileFound or where can I add this statement
Me.ListBoxName.AddItem FileName

ab
 
A

abkad

Thank you this question is helpful for me but how can I change the event
procedure fs_FileFound or where can I add this statement
Me.ListBoxName.AddItem FileName

ab
 
S

Stuart McCall

abkad said:
Thank you this question is helpful for me but how can I change the event
procedure fs_FileFound or where can I add this statement
Me.ListBoxName.AddItem FileName

ab

First of all, open the form in design view (after first making a copy),
right-click on the big textbox control and select 'Change To' then select
Listbox.

Open the form's module, find the fs_FileFound procedure and replace the
contents with the above statement. Obviously you need to change ListboxName
to the actual name on the form which, if you haven't changed it, is Text0.
IOW the line should read:

Me.Text0.AddItem FileName

Save the design, then open the form normally and try it out. Should work
straight out of the box.
 
S

Stuart McCall

abkad said:
Thank you this question is helpful for me but how can I change the event
procedure fs_FileFound or where can I add this statement
Me.ListBoxName.AddItem FileName

ab

First of all, open the form in design view (after first making a copy),
right-click on the big textbox control and select 'Change To' then select
Listbox.

Open the form's module, find the fs_FileFound procedure and replace the
contents with the above statement. Obviously you need to change ListboxName
to the actual name on the form which, if you haven't changed it, is Text0.
IOW the line should read:

Me.Text0.AddItem FileName

Save the design, then open the form normally and try it out. Should work
straight out of the box.
 
A

abkad

thank you for your help I did as you said but this massege appear to me "The
rowsource property must be set to 'value list' to use this methode"
 
A

abkad

thank you for your help I did as you said but this massege appear to me "The
rowsource property must be set to 'value list' to use this methode"
 
A

abkad

Thank you I solve it. Now I have a Listbox of files, How can I convert these
data to a table.
 
A

abkad

Thank you I solve it. Now I have a Listbox of files, How can I convert these
data to a table.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top