View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
fallowfz fallowfz is offline
external usenet poster
 
Posts: 12
Default File Browse Function?

JerryH -

That seemed to work, but I was looking for a way to tell the macro to
work on the files which I've selected...not just show the file name.
Is there a way to extend what you've done for this application?

This piece of code below will populate an excel template with the
*.txt file names in a specific directory. This saves me the time of
typing each one out. Is there a way, perhaps via an input box, to not
be tied to one specific directory?

Sub ListFiles()

Const MYPATH = "C:\MyDocuments\"

Dim PutRow As Long, fName As String
PutRow = 1
Columns("a").Clear
fName = Dir(MYPATH & "*.txt")
Cells(PutRow, "a") = fName
PutRow = PutRow + 1
Do
fName = Dir
Cells(PutRow, "a") = fName
PutRow = PutRow + 1
Loop Until fName = ""


End Sub