473,394 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Search and Grab information from multiple files

Is there VBA code that would search a folder full of files, only grab information in certain rows that match values specified, and put those values in a new spreadsheet in a new row for each file with the matching information.

Any help would be great! Thank you!
Aug 13 '06 #1
1 1900
Killer42
8,435 Expert 8TB
Is there VBA code that would search a folder full of files, only grab information in certain rows that match values specified, and put those values in a new spreadsheet in a new row for each file with the matching information.

Any help would be great! Thank you!
Probably the simplest thing would be to use Dir$() to loop through the files, Open them for Input, and read them line by line and examine the strings. There are other (and probably better) ways, of course. For instance, using the Scripting Runtime lets you make use of FileSystemObject with various capabilities for finding and accessing folders, files, etc.

Anyway, here's a very quick sample (not tested) of the simpler Dir$ method...
Expand|Select|Wrap|Line Numbers
  1. Dim FileName As String, Text As String
  2. FileName = Dir$("C:\Test\abc*.txt") ' Use your own wildcard here
  3. While FileName <> ""
  4.   Open FileName For Input Access Read Shared As #1
  5.   Do Until EOF(1)
  6.     Line Input #1, Text
  7.     If <this string passes some test> Then
  8.       <Grab the information and put it wherever>
  9.     End If
  10.   Loop
  11.   FileName = Dir$
  12. Loop
Oct 19 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: RiceGuy | last post by:
Hi! I'm looking for ideas on what would the best approach to design a search system for a RSS feeds. I will have some 50 RSS feeds (all RSS 2.0 compliant) stored locally on the web server. Now I'm...
16
by: Stanley Sinclair | last post by:
Bear with me. I am being very calm; took a Valium. I have waited two weeks to write this, because every time I wrote it before the message was, at best, nasty. I need to use the services of...
2
by: Alphonse Giambrone | last post by:
Is there a way to use multiple search patterns when calling Directory.GetFiles. For instance Directory.GetFiles("C:\MyFolder", "*.aspx") will return all files with the aspx extension. But what if...
5
by: willington79 | last post by:
Hello all, We have a payroll application that runs with MS Access. It is comprised of several different database files and one ms access mdb file for each client. This means there can be from...
3
by: Chung Leong | last post by:
Here's the rest of the tutorial I started earlier: Aside from text within a document, Indexing Service let you search on meta information stored in the files. For example, MusicArtist and...
4
by: shapper | last post by:
Hello, I am working on a web site which displays various information from a database: 1. Text articles 2. PDF files for download. The links and displayed information are also retrieved...
2
by: Krustov | last post by:
I wrote this a while ago and found it comes in very handy at times . For example , If you want to know what webpages use a certain stylesheet its just a matter of typing in the stylesheet name...
9
by: Stef Mientki | last post by:
hello, I want to search multiple textfiles (python source files) for a specific word. I can find all files, open them and do a search, but I guess that will be rather slow. I couldn't find...
0
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.