View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
38N90W 38N90W is offline
external usenet poster
 
Posts: 10
Default Populate Listbox with File Name Only


"Justin" wrote in message
om...
Hi,
I have various ways to populate a list box with .xls files, yet when I
do this I get the FileName to appear as well as the entire Directory
attached to that file. How should I go about Populating the list Box
with Only the File Name?
Right now in listbox1 I have

"C:\Program Files\File1.xls"
"C:\Program Files\File2.xls"
"C:\Program Files\File3.xls"

what I really want is

"File1.xls"
"File2.xls"
"File3.xls"

Thanks in advance!

Justin


Not tested.

Sub TestMe()

Dim wb as Workbook

For Each wb in Workbooks
MyForm.ListBox1.AddItem wb.Name
Next wb

End Sub

-gk-