word 2007 text finder/counter

colmac
StarLounger
Posts: 65
Joined: 01 Apr 2011, 18:43

word 2007 text finder/counter

Post by colmac »

I am looking to create a routine to analyze some long (often 50,000 lines of computer code) text files and report back with some info

By default, I want it to find, copy, count and then display that line in a table in a new document, the number of occurences of a list of text strings (probably about 10 to 12 items, but I may need to add more, not necessarily under prog control).

So for example, I want to find lines that contain (amongst other items)

customTransitionName=
and
caption.logFont.lfFaceName=

Theses strings will inevitably be in the middle of a line of code,

and I'd like to create a table to show me for each item searched, the left part of the string, the right part of the string, and then a count for each variation of the right hand end eg the font name used

The source will always be a txt file, and I initially guessed that Word might be simplest to work in, but if its easier in Access or Excel, I'd have no major issues. Word might be easier for others who will use the routine to work in however.

I am far from an expert, but if pointed in the right direction, I can usually (over several days) make what I want work, but I need that pointer to get me started correctly. I enjoy that bit, but I can never get started, as there seems to be 10 ways to do everything in code.

Can anyone point me to any ideas, or existing code that might do some of what I want so I can use it as a starter.

Thanks

colmac
StarLounger
Posts: 65
Joined: 01 Apr 2011, 18:43

Re: word 2007 text finder/counter

Post by colmac »

I have managed to get a great start using Access.

Created a MakeTable query with all the text searches I want and it works great. I can then create a report from there

This might be all I need, but it will not be so friendly for other users who have never used Access in their lives.

Colin

User avatar
HansV
Administrator
Posts: 78488
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: word 2007 text finder/counter

Post by HansV »

You could create a form a command button that runs the make-table query, another button that displays the report, and a third button that quits Access.
Then set that form to be opened automatically when the database is opened (Office button > Access Options > Current Database, Display Form dropdown).
That way, users don't need to be familiar with Access.
Best wishes,
Hans

colmac
StarLounger
Posts: 65
Joined: 01 Apr 2011, 18:43

Re: word 2007 text finder/counter

Post by colmac »

Thanks

Thats sounds workable.

I've spent the time sorting out the exact layout of the query and report, so I'll look at this aspect later.

Colin