excel vba file search


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 6 of 6

Thread: excel vba file search

  1. #1
    Join Date
    Nov 2007
    Posts
    11

    Exclamation excel vba file search

    using this code returns 0 files found
    from windows search the files are found...
    I AM LOST IN THIS THING

    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    If Target.Column = 10 And Target.Row = 1 Then
    Cancel = True
    For Each c In Range("fnam")
    fn = c.Value
    FilePath = "C:\SC Engineering"
    FileSpec = fn '& ".*"
    MsgBox FileSpec
    FilesFixed = 0

    Set FS = Application.FileSearch

    With FS
    .NewSearch
    .LookIn = FilePath
    .FileName = FileSpec
    .SearchSubFolders = True
    .Execute
    foundFileCount = .FoundFiles.Count
    MsgBox .FoundFiles.Count
    End With
    If foundFileCount = 0 Then
    MsgBox "No files found."
    Exit Sub
    End If
    Next c
    Else: Cancel = False
    End If
    End Sub

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Have you stepped through the code to see what it is actually doing?
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  3. #3
    Join Date
    Nov 2007
    Posts
    11

    Exclamation Reply

    it says 0 files found
    each msbox shows the steps it is just returning o files found

  4. #4
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    No, I mean put a break at the beginning of the routine and step through the code execution using F8
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  5. #5
    Join Date
    Nov 2007
    Posts
    11
    did that and it appears as if it is looking at a blank directory...
    the code executes fine..I think there is something missing
    I get no errors..
    i use msgbox like debug.print
    still lost

  6. #6
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    What do you mean by "blank directory"?

    Is the directory empty?
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

Similar Threads

  1. Loop thru an excel file thru VB
    By Sinni in forum VB Classic
    Replies: 2
    Last Post: 07-31-2007, 02:27 AM
  2. mutual exclusive write to Excel file
    By extreme in forum VB Classic
    Replies: 0
    Last Post: 06-13-2007, 10:51 PM
  3. Create excel file regardless of version installed
    By jewkaheng in forum VB Classic
    Replies: 2
    Last Post: 07-18-2005, 09:46 AM
  4. How long before the next version??
    By _CAG in forum .NET
    Replies: 146
    Last Post: 08-12-2002, 11:40 PM
  5. File uploading / objFile.Write problem
    By Tomer Cagan in forum ASP.NET
    Replies: 1
    Last Post: 07-24-2001, 10:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center