Find all the files in a folder

I had been using the FileSearch function to locate all the files of a 
particular type in a folder.  Office2007 appears to have replaced that 
function with a FileSystemObject class, but i can't get that to work.  Here 
is what I had been using.  Any help would be appreciated.

    Set fs = Application.FileSearch
With fs
    .LookIn = Range("C7").Value
    .SearchSubFolders = True
    .FileName = "*.csv"
    If .Execute() > 0 Then
        Row = 1
        For i = 1 To .FoundFiles.Count

12/15/2009 11:02:02 PM
excel.programming 6508 articles. 2 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 36

Hi Phil

This works in 2007 although it is not clear from your code post what
you want to do.  Looks like you are counting the files found so that
is what the following does.  Post if you want a more specific reply.

Take care


Option Explicit
Sub Open_Txt()
Dim oWbk As Workbook
Dim wb As Workbook
Dim sFil As String
Dim sPath As String
Dim strFullName As String
Dim Cnt As Integer
Dim i As Integer

Application.DisplayAlerts = False
Application.ScreenUpdating = False

    Cnt = 0
    sPath = "R:\"
    ChDir sPath
    sFil = Dir("*.csv")

 Do While sFil <> ""
     strFullName = sPath & sFil
        sFil = Dir
        Cnt = Cnt + 1
MsgBox Cnt

End Sub
12/16/2009 12:22:01 AM

Similar Artilces:

Excel file e mail addresses into address group list
I want to take the .csv file from excel into my outlook express address book then copy addresses (select members) into a group list. Then I want to keep that address in the group list, but erase from the address book. Hi Jack, First back up your Windows Address Book ( .WAB) Export your address book to a .csv format so that you are sure you have the formatting correct (all the fields). When you import your .csv file to the address book, you must add one more column to your Excel file and fill it with a single blank. This will generate the need comma at the end of each row -- fail...

Moving files Outlook 2003
I am moving my outlook files to a new computer. Does anyone know how to accomplish this move? Wayne <> wrote: > I am moving my outlook files to a new computer. Does > anyone know how to accomplish this move? tells the files. The easiest is to simply copy your PST to the new PC, put it in some folder, giving it a name that doesn't match any other PST, make sure it's not read-only, and use Outlook's File>Open>Outlook Data File to open it. -- Brian Tillman ...

Missing Measures in .cub file created in Excel
After using Excel's Offline OLAP features which create a local cube file (.cub), many of the desired measures which I included in the wizard setup are not displayed. I'm looking for a reason for this. The data populating this cube file is from a virtual cube, so background calculations take place. I considered that those measures requiring calculation would not be included once seperated from the original virtual cube... but many calculated measures WERE included so I don't think that's the complete explination. I've varied the measures included in the .cub file...

missing public folder #2
For some reason completely unknown to me, many of the public folders dissappeared from the M drive and are no longer accessible from the Outlook clients. On the other hand, when I look at the Exchange administration program the folders are all there and the permissions seem correct. Is there any way of getting these back without doing a complete system/Exchange restore? Sounds like Joe has exactly the same problem I am describing. I did look at the EMS and all of the folders are indicated and the permissions are correct. No one touched these things. Still they do not appear on the M drive a...

how to extact a compressed file
I cannot uzip my zipped files ..Help Winnie Hello Winnie Winnie wrote: > I cannot uzip my zipped files ..Help is this a Word problem? Have you inserted ZIP files as objects in word, for instance? If not, better ask in a forum/newsgroup for your ZIP application or your operating system HTH Robert -- /"\ ASCII Ribbon Campaign | MSFT | \ / | MVP | Scientific Reports X Against HTML | for | with Word? / \ in e-mail & news | Word | ...

Help with message to folder delivery please
I've googled and googled and checked Windows support so I thought I would ask the experts: Using Outlook 2002 When an http email account is created in outlook 2002, it is always placed outside the "outlook today" folder. Here is what I would like to do I would like to plug in my pocket pc, synch with the desktop, and pull my hotmail emails into my pocket pc Currently I can synch with the pc just fine but the pocket pc doesn't download any new emails because it refuses to sych with anything other than the "outlook today" portion of Outlook. I have attempted seve...

Pubic Folder Store Email Address
Hi, Environment is SBS2003. Have the unusual problem that for some reason the Public Folder Store is using the SMTP address of one of our users, therefore when email is sent to the user we receive a NDR telling us there is a duplicate address is the system. Using the ldp.exe utility (The folder it is located is hidden) I've found the address is the Public Folder Store under the config directory in the active, but I do not know how to change it?? Any Help? ...

Deleted Messages in Public Folder Reappear
I'm running Exchange 2003 (6.5.6944.0) on windows 2003 sp1. We have several public folders for people to post stuff to. Most people can't delete stuff from the public folders but a few of us should be able to. However, when we delete a message it will come back, sometimes after a few minutes, sometimes after a longer time, but it will come back. Has anyone got any ideas on how to fix this so deleted items don't come back. Thanks in advance, Sean In, Sean <> typed: > I'm running Exc...

Automatically move mail *from* Deleted Items folder
I get a lot of email that I read quickly then delete using a swift press on the delete key which drops the mail into the Deleted Items folder. However, I never want to loose the mail so I regularly move all the mail from Deleted Items into another folder for storage. Is there any way I can get Outlook 2002 to automatically move any items that arrive in Deleted Items to another folder? I can't get it to work with the Rules Wizard as it only allows me to run rules on my Inbox. Alternatively, how do I set up a method to move the mail from my Inbox to the storage folder directly without goi...

Get rid of "folder sizes" and "data file management" links
at the bottom of the folder list? I'd love to remove these to make more space available in the list. Thanks. ...

working with default data files
I am using IMAP and I would like to config outlook to bring all my emai to the default "personal folders" or delete that folder. Is tha possible -- g.garrett ----------------------------------------------------------------------- g.garrette's Profile: View this thread: Posted from - http://www.officehelp.i g.garrette <> wrote: > I am using IMAP and I would like to config outlook to bring all my > email to the default "personal fo...

Problem restoring backup file from money 98 to money 04
Just upgraded to a new computer with Money 2004 --- Have transferred my money back-up file to the new computer --- Everytime I try to open using Money 2004 it begins the process of converting the file and then times out (stops responding) Any ideas??? Extremely frustrating as I don't want to lose 6 years of financial data ---- Thanks How long have you waited? It could take a long time--like tens of minutes. While it is in this state, it will be "not responding." This doesn't mean it's dead, just hat it's busy. "jh227" <anonymous@discussions.micr...

How to statically linking 2 files for 32 bit and 64 bit in VC++ 2005
I am trying to statically link a xyz.lib file to my 32-bit VC++ 2005 MFC app in order to use a .sys file. I have two xyz.lib files, one for win32 and one for amd64. I know I should add the .lib file to ['Property Pages' > 'Linker' > 'Input' > 'Additional Dependencies'] But which file do I add, how do I add both files, and how do I ensure the 32-bit app can use the linked .sys on 32-bit as well as 64-bit? Thanks! Hi, Just use the 32 bit lib, your app will run on 64 bit via WOW64. 64 bit development would involve setting up a new cpu platform, whi...

Exchange 2000/2003 Public Folder item Permissions Problem
Hi all, I've been having an issue with Public Folder permissions for some time now. The folder contains contacts for all company employees (most of which aren't on the company network), and is maintained by HR. Brief history is: Had Exchange 2000 on Win Server 2000, and a previous administrator modified public folder permissions on the M drive in explorer (a no-no). This resulted in the ESM "Invalid window handle" error. Managed fix these by following KB 270905 (permissions nuke), and deleting and re-creating the public folder. The latter was a problem, as most users were ...

trouble openning file
I am drawing a blank again regarding the correct way to read files. Here is the pertinent section of code I am troubled by: CString JobFile="C:\\temp\\1.dat"; CFile in; CByteArray buffer; if(!in.Open(JobFile, CFile::modeRead)){ AfxMessageBox("Error opening file"); return; } buffer.SetSize(in.GetFileSize()); if(in.Read(buffer.GetData(), buffer.GetSize()) != buffer.GetSize()){ AfxMessageBox("Error reading file"); return; } in.Close(); When I compile I get the following error: error C2039: 'GetFileSize' : is not a member ...

GDI+ mfc save Bitmap to File Stream
Hi, I am using GDI+ in mfc. I have a file pointer declared as File *fpOut; This file pointer is also used for writing to other text data to the file. I am not sure how to save an image to this file stream. When Bitmap.Save function to save to stream the first parameter is of type IStream and not FILE. Any suggestions on what can be done? Thanks, -Asfar ...

Find all cells with a number and mulitply
How can I find all cells in a sheet that are a number greater than zero and multiply each one by a number? IE: the number to multiply by is 1.2 A1 Tom A2 25 A3 0 G12 Bob G13 25 I want to programatically (without using a macro) find cells a2 and g13 only and multiply them by 1.2 Thanks in advance for your help. Jim Jim, As long as you don't have any negative numbers, it doesn't matter about being > 0 (0*n=0) or being text. Try this Put 1.2 in a spare cell and then copy it Select all the cells Goto menu Edit>Pastespecial Click the Multiply option OK out Now clear the c...

Import/Export sql tables to an XML file?
Hi, How can I export/import data from SQL server tables to/from an XML file? Note: I want to tdo this from a desktop application written in c# and uses sql server tables for storing data. Is there a way to do this? Also, are there libraries that already do this? Thanx in advance... ...

How do I create Folders/Sub folders from User Form control button
I have a User Form that I would like to take one of the spare control buttons and have it set up my job folder on the hard drive. I am not sure how to code it to achive the following results: These are my text box ID's Main Folder --------------------------------------------------------------------- User Selects drive: \ CES_No_1 \ CLLI_Code_1\ TEO_No_1 Sub Folders inside Main Folder ---------------------------------------------------------------------- Completed Drawings Elec Job Folder Misc Job Documents Site Pictures If you can dig up a copy of the VBS doc...

importing excel files into outlook 2007
I did an import and it worked perfectly. I tried to ddo a second, and am receiving a message that - an error occuredwhile importing or exporting and the import/export was terminated. MAPI error 0x80070057 was reported. please try again. I have rebuild the file, changes names and still receive the same message. I looked on ms faq but can't find how to fix the problem. Can anyone help. Thanks Dick Take a look at both of these sights... Anvil22 wrote: >I did...

Max limit in resource.h file of VC++
Hi, We specify the next step number for the resources, commands and control by the following. _APS_NEXT_RESOURCE_VALUE _APS_NEXT_COMMAND_VALUE _APS_NEXT_CONTROL_VALUE Do we have any way to restrict the numbers or specify the max limit. eg. I want my resource to have command values from 1 to 100. So #define _APS_NEXT_COMMAND_VALUE 1 // Next command number Can I specify somewhere in the resource.h file saying 100 is the max if it goes beyond 100, throw an error? Thanks, Prashant. ...

Can't open XP file in Windows
We have XP machines and Windows machines. A Publisher file was created in XP and I am unable to open it in Windows. The error message is "You cannot open a file from a different version". I would appreciate any assistance on this issue. Hi gwen (, in the Microsoft� newsgroups you posted: || We have XP machines and Windows machines. A Publisher file || was created in XP and I am unable to open it in Windows. || The error message is "You cannot open a file from a || different version". I would appreciate any assistance on || this issu...

Outlook 2000 Personal Folders
I have a Windows XP computer, running Office 2000. I went to send an email to a friend and when I tried to send it, it took a day and a half and never came out of my outbox. When I try to delete it, I get an access denied. When I try to go into it, I get an error message that says "Can't open this item. The MAPI Spooler has already begun transmitting this message" and then it locks up Outlook. I want to know if there is a way to delete this email. I cannot send or receive ANY emails while this one email is in my outbox. PLEASE HELP!! ...

How do I sync Signatures and folders between different machines?
I use Outlook on two different machines and the set up is not synched correctly. My home version does not update when I add new folders on the work laptop and the signatures are not saved in the home PC version. The signatures were created on the laptop and saved there. I need help!!!!!!!!!!! What type of mail account? How are you currently attempting to sync? (outlook doesn't sync without the use of third party tools) What version of Outlook? "Ben Davidson" <Ben> wrote in message news:708A9243-C1D4-48FD-84FE-7B37BB49FF99@...

Opening Publisher 2000 file with Publisher 2003
I have been sent a file created in 2000, but use 2003, which says it cannot open earlier versions. Is there a download solution to this? -- Ghento Publisher 2003 will open 2000 documents. Some things to try: Disable your anti-virus software. Try opening the file in safe mode. Publisher 2000 and 2003 uses different WordArt, this could be a problem. Publisher 2003/2002 Add-in: WordArt Compatibility How to troubleshoot a damaged publication in Publisher