Results 1 to 2 of 2

Thread: [RESOLVED] display no of files in a folder[whats wrong here]

  1. #1

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Resolved [RESOLVED] display no of files in a folder[whats wrong here]

    error occuring invalid procedure call or argumant......
    in following code

    VB Code:
    1. Dim objFS As New Scripting.FileSystemObject
    2. Dim objFolder As Scripting.Folder
    3. Private Sub Command2_Click()
    4. If objFS.FolderExists("C:\windows\system") Then
    5.     Set objFolder = objFS.GetFolder("C:\windows\system")
    6.     MsgBox objFolder.Files.Item(2).Name
    7. End If
    8.  
    9. Set objFolder = Nothing
    10. Set objFS = Nothing
    11. End Sub

  2. #2

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Thumbs up Re: display no of files in a folder[whats wrong here]

    VB Code:
    1. 'get the solution
    2. Function ShowFileList(ByVal Folderspec As String)
    3.     Dim fs, f, f1, fc, s
    4.     Set fs = CreateObject("Scripting.FileSystemObject")
    5.     Set f = fs.GetFolder(Folderspec)
    6.     Set fc = f.Files
    7.     For Each f1 In fc
    8.         s = s & f1.Name
    9.         s = s & vbCrLf
    10.     Next
    11.     MsgBox s
    12. End Function
    13. 'Thanks all

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width