Hi All,
Any Help. Please .. Regards, Upendra Singh +91-9910227325, +91-9310760597 ---------------------------------------------------------------------------- --------------------------------- There are 10 kinds of people: Those who understand binary and those who don't. ---------------------------------------------------------------------------- --------------------------------- From: Upendra Singh [mailto:upendrasinghsen...@gmail.com] Sent: Monday, June 29, 2009 6:02 PM To: 'excel-macros@googlegroups.com' Subject: Need Help for File Searching Macro Hi All, I've created one macro that will look into non-blank cells in Column A and search for all file with that extension. This macro was working fine previously but I don't know what happened now, it's not running. Can Anybody help here. May be there is some error or I'm missing any library. Regards, Upendra Singh +91-9910227325, +91-9310760597 ---------------------------------------------------------------------------- --------------------------------- There are 10 kinds of people: Those who understand binary and those who don't. ---------------------------------------------------------------------------- --------------------------------- --~--~---------~--~----~------------~-------~--~----~ ---------------------------------------------------------------------------------- Some important links for excel users: 1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at http://www.excelitems.com 2. Excel tutorials at http://www.excel-macros.blogspot.com 3. Learn VBA Macros at http://www.vbamacros.blogspot.com 4. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com If you find any spam message in the group, please send an email to: Ayush Jain @ jainayus...@gmail.com or Ashish Jain @ 26may.1...@gmail.com <><><><><><><><><><><><><><><><><><><><><><> HELP US GROW !! We reach over 5,000 subscribers worldwide and receive many nice notes about the learning and support from the group. Our goal is to have 10,000 subscribers by the end of 2009. Let friends and co-workers know they can subscribe to group at http://groups.google.com/group/excel-macros/subscribe -~----------~----~----~----~------~----~------~--~---
Sub SearchAllFiles() Dim RCntr As Long Let RCntr = 1 Worksheets("FilestoSearch").Activate Cells(RCntr, 1).Activate Do While ActiveCell.Value <> "" SearchForFiles (ActiveCell.Value) Worksheets("FilestoSearch").Activate RCntr = RCntr + 1 Cells(RCntr, 1).Activate Loop End Sub Sub SearchForFiles(FiletoSearch As String) 'Declare a variable to act as a generic counter. Dim lngCount As Long InsertWorkSheet (FiletoSearch) Sheets(FiletoSearch).Activate Range("A1").Activate With Application.FileSearch .NewSearch .Filename = "*." & FiletoSearch .LookIn = "C:\" .SearchSubFolders = True If .Execute <> 0 Then For lngCount = 1 To .FoundFiles.Count ActiveCell.Value = .FoundFiles.Item(lngCount) ActiveCell.Offset(1, 0).Activate Next lngCount Else MsgBox "No files found." End If End With End Sub Sub InsertWorkSheet(WorksheetName As String) Dim NewSheet As Worksheet Set NewSheet = Worksheets.Add NewSheet.Name = WorksheetName End Sub