sLibFile = "D:\Temp\\FunctionLibrary.txt"
sResFile = "D:\Temp\Res.txt"
Call GetAllFuncNames(sLibFile,sResFile)
Function GetAllFuncNames(sLibFile,sResFile)
On Error Resume Next Const ForReading = 1 Set oFso = CreateObject("Scripting.FileSystemObject") 'Open Txt File Set oTempFile = oFso.GetFile(sLibFile) Set oFile = oTempFile.OpenAsTextStream(1, true) sAllData = oFile.ReadAll oFile.Close Set oFile = Nothing Set oTempFile = Nothing If Instr(sAllData,"a")<= 0 Then Set oFile = oFso.OpenTextFile(sLibFile,1) sAllData = oFile.ReadAll oFile.Close Set oTempFile = Nothing Set oFile = Nothing End If aAllData = Split(sAllData,VBNewLine) 'Find Func Names For iCurRow = 0 To Ubound(aAllData) -1 sRowData = aAllData(iCurRow) sRowData = Cstr(Trim(sRowData)) If sRowData <> "" And Len(sRowData) >= 5 Then If (Instr(sRowData,"Function ") > 0 Or Instr(sRowData,"Sub ") > 0) Then If Err.Number = 0 Then bFound = True aTemp = Array("[","?","*","""","\","<>","#","~","%","{","}","+",".","@","/","!",";","]","'","End Function","End Sub") For i = 0 To Ubound(aTemp) If Instr(sRowData,aTemp(i)) > 0 Then bFound = False : Exit For Next If bFound Then sCurFuncName = Trim(sRowData) If sAllF = "" Then sAllF = sCurFuncName Else sAllF = sAllF & VBNewLine & sCurFuncName End If End If End If End If End If Err.Clear Next 'Create Txt File with All Func Names Set oFile = oFso.CreateTextFile(sResFile, True) oFile.Write "===================" & VbNewLine oFile.Write "Total Count : " & Ubound(Split(sAllF,VbNewLine)) oFile.Write VbNewLine & "===================" & VbNewLine oFile.Write sAllF & VbNewLine oFile.Write "================================== E N D====================================" oFile.Close Set oFile = Nothing Set oFso = Nothing
End Function
Comments