Solved

Folder contents

Posted on 2013-12-05
4
228 Views
Last Modified: 2013-12-06
How do I find the number of items in a folder? For example if the folder has 100 Excel worksheets, how can I find this?
0
Comment
Question by:Conernesto
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 total points
ID: 39699804
You could try a macro like this:
Sub ListXlFiles()
    Dim strFileName As String
    Dim strFolder As String
    Dim iCount As Integer
    strFolder = "C:\MyFolder"
    strFileName = Dir$(strFolder & "\*.xl")
    Do Until strFileName = ""
        iCount = iCount + 1
        strFileName = Dir$()
    Loop
   MsgBox "There are " & iCount & " relevant files in the folder"
End Sub

Open in new window

0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 39699811
Note that a Worksheet is a part of a Workbook file. It is not a stand-alone entity.
0
 

Author Comment

by:Conernesto
ID: 39699816
I really meant the number of workbooks. The extension of these particular workbooks is .xsl
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 39699824
OK see if it works. It should look for most types of Excel file.
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question