SBrooky
07-31-2012, 07:57 AM
Hello, Ive found this function online and I want to change it so that it just counts .exe files as oppose to any file extention. Any ideas:
Function FlrFileCount(sFileFlr As String) As Long
On Error GoTo Error_Handler
Dim fso As Object
Dim flr As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Set flr = fso.GetFolder(sFileFlr)
FlrFileCount = flr.Files.Count
Error_Handler_Exit:
On Error Resume Next
Set flr = Nothing
Set fso = Nothing
Exit Function
Error_Handler:
MsgBox "The following error has occured." & vbCrLf & vbCrLf & _
"Error Number: " & Err.Number & vbCrLf & _
"Error Source: FlrFileCount" & vbCrLf & _
"Error Description: " & Err.Description, _
vbCritical, "An Error has Occured!"
Resume Error_Handler_Exit
End Function
Function FlrFileCount(sFileFlr As String) As Long
On Error GoTo Error_Handler
Dim fso As Object
Dim flr As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Set flr = fso.GetFolder(sFileFlr)
FlrFileCount = flr.Files.Count
Error_Handler_Exit:
On Error Resume Next
Set flr = Nothing
Set fso = Nothing
Exit Function
Error_Handler:
MsgBox "The following error has occured." & vbCrLf & vbCrLf & _
"Error Number: " & Err.Number & vbCrLf & _
"Error Source: FlrFileCount" & vbCrLf & _
"Error Description: " & Err.Description, _
vbCritical, "An Error has Occured!"
Resume Error_Handler_Exit
End Function