View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default How to Get Files.FullName

Replace
Me.ListBox1.AddItem (Filename)

with
Me.ListBox1.AddItem FolderName & FileName

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Wed, 18 Feb 2009 07:42:37 -0800 (PST), K
wrote:

I have macro (see below) which put all kind of files names in ListBox1
from specified folder

Private Sub CommandButton1_Click()
Me.ListBox1.Clear
Dim Filename As String
Dim Foldername As String

Foldername = "C:\Documents and Settings\Files\"
Filename = Dir(Foldername)
Do Until Filename = ""
Me.ListBox1.AddItem (Filename)
Filename = Dir
Loop
End Sub

How can I get files full name or path in ListBox1. For example get
name like "C:\Documents and Settings\Files\Flag.pdf" instead of
"Flag.pdf". I know there is some modification needed in macro above
can any friend help.