Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default File directory into a listbox

All,

In listbox1 I am trying to retreive the contents of directory
"k:\files\*.csv" and am having real problems in doing this.

Can anyone give me the quick answer.

Thank you.

Richard


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default File directory into a listbox

Richard,

Try something like

Private Sub CommandButton1_Click()
Dim FName As String
With Me.ListBox1
.Clear
FName = Dir("k:\files\*.csv")
Do Until FName = ""
.AddItem FName
FName = Dir()
Loop
End With
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Richard Edwards" wrote in message
...
All,

In listbox1 I am trying to retreive the contents of directory
"k:\files\*.csv" and am having real problems in doing this.

Can anyone give me the quick answer.

Thank you.

Richard




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default File directory into a listbox

Thank you very much. Spot on!

Just another quick question that I forgot to ask 1st time round. How do I go
about using the file I have highlighted?

ie: variable = listbox1.selection(?)

Thank you.

Richard


"Chip Pearson" wrote in message
...
Richard,

Try something like

Private Sub CommandButton1_Click()
Dim FName As String
With Me.ListBox1
.Clear
FName = Dir("k:\files\*.csv")
Do Until FName = ""
.AddItem FName
FName = Dir()
Loop
End With
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Richard Edwards" wrote in message
...
All,

In listbox1 I am trying to retreive the contents of directory
"k:\files\*.csv" and am having real problems in doing this.

Can anyone give me the quick answer.

Thank you.

Richard






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default File directory into a listbox

Richard,

To get the selected file in the list box, use

With Me.ListBox1
If .ListIndex = 0 Then
Variable = .List(.ListIndex)
End If
End With


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Richard Edwards" wrote in message
...
Thank you very much. Spot on!

Just another quick question that I forgot to ask 1st time round. How do I

go
about using the file I have highlighted?

ie: variable = listbox1.selection(?)

Thank you.

Richard


"Chip Pearson" wrote in message
...
Richard,

Try something like

Private Sub CommandButton1_Click()
Dim FName As String
With Me.ListBox1
.Clear
FName = Dir("k:\files\*.csv")
Do Until FName = ""
.AddItem FName
FName = Dir()
Loop
End With
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Richard Edwards" wrote in message
...
All,

In listbox1 I am trying to retreive the contents of directory
"k:\files\*.csv" and am having real problems in doing this.

Can anyone give me the quick answer.

Thank you.

Richard








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default File directory into a listbox

Got it. Thank you.


"Chip Pearson" wrote in message
...
Richard,

To get the selected file in the list box, use

With Me.ListBox1
If .ListIndex = 0 Then
Variable = .List(.ListIndex)
End If
End With


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Richard Edwards" wrote in message
...
Thank you very much. Spot on!

Just another quick question that I forgot to ask 1st time round. How do

I
go
about using the file I have highlighted?

ie: variable = listbox1.selection(?)

Thank you.

Richard


"Chip Pearson" wrote in message
...
Richard,

Try something like

Private Sub CommandButton1_Click()
Dim FName As String
With Me.ListBox1
.Clear
FName = Dir("k:\files\*.csv")
Do Until FName = ""
.AddItem FName
FName = Dir()
Loop
End With
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Richard Edwards" wrote in message
...
All,

In listbox1 I am trying to retreive the contents of directory
"k:\files\*.csv" and am having real problems in doing this.

Can anyone give me the quick answer.

Thank you.

Richard










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
file save error: the file or directory cannot be created dublg Excel Discussion (Misc queries) 1 September 25th 06 07:07 PM
Excel should let me sort the file directory when saving a file Beanee70 Excel Discussion (Misc queries) 0 March 14th 06 07:03 AM
backing up file in directory [email protected] Excel Programming 6 November 9th 03 07:35 PM
listbox.value not equal to listbox.list(listbox.listindex,0) ARB Excel Programming 0 October 22nd 03 12:46 AM
get path - save new file - same sub-directory as existing file tegger Excel Programming 2 October 21st 03 10:45 AM


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