?
Solved

Folder contents

Posted on 2013-12-05
4
Medium Priority
?
235 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
New style of hardware planning for Microsoft Exchange server.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

765 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