Sub ListTxtAndHTML()
Dim I As Long
Dim strFileName As String
Dim strFriendlyName As String
ActiveSheet.Range("A1:B1") = Array("Text", "HTML")
With Application.FileSearch
.NewSearch
.LookIn = "C:\Papers\"
.Filename = "*.txt*"
.Execute
For I = 1 To .FoundFiles.Count
strFileName = Mid(.FoundFiles(I), InStrRev(.FoundFiles(I), "\") + 1)
strFriendlyName = Left(strFileName, InStrRev(strFileName, ".") - 1)
ActiveSheet.Range("A" & (I + 1)) = "<option VALUE=" & Chr(34) & "../" & strFileName & Chr(34) & ">" & strFriendlyName & "</option>"
Next
End With
With Application.FileSearch
.NewSearch
.LookIn = "C:\Papers\"
.Filename = "*.htm*"
.Execute
For I = 1 To .FoundFiles.Count
strFileName = Mid(.FoundFiles(I), InStrRev(.FoundFiles(I), "\") + 1)
strFriendlyName = Left(strFileName, InStrRev(strFileName, ".") - 1)
ActiveSheet.Range("B" & (I + 1)) = "<option VALUE=" & Chr(34) & "../" & strFileName & Chr(34) & ">" & strFriendlyName & "</option>"
Next
End With
End Sub