[RESOLVED] display no of files in a folder[whats wrong here]
error occuring invalid procedure call or argumant......
in following code
VB Code:
Dim objFS As New Scripting.FileSystemObject
Dim objFolder As Scripting.Folder
Private Sub Command2_Click()
If objFS.FolderExists("C:\windows\system") Then
Set objFolder = objFS.GetFolder("C:\windows\system")
MsgBox objFolder.Files.Item(2).Name
End If
Set objFolder = Nothing
Set objFS = Nothing
End Sub
Re: display no of files in a folder[whats wrong here]
VB Code:
'get the solution
Function ShowFileList(ByVal Folderspec As String)
Dim fs, f, f1, fc, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(Folderspec)
Set fc = f.Files
For Each f1 In fc
s = s & f1.Name
s = s & vbCrLf
Next
MsgBox s
End Function
'Thanks all