The PODA Blog

News, views and articles from our membership

Archive for July, 2007

Use MS Word to Collect Info while Browsing the Web

Posted by Brian Mulder on 10th July 2007

Introduction
If research is part of your job than you can come across hundreds of small stories on the web each week. Most of that data comes from different sites and at times you read the same story more than once. A lot of so-called news is copied and published on several news sites with no addition of value. But to stay on top of your business, it is paramount to be sure that you miss nothing and be able to distill the small gems of information between all the “infotainment”.

Our goal is to develop a small tool to help us filtering our data exposure during the week and collect the information we think is valuable.

An example
Each week we produce a short report based on a set of companies and their main themes for the past week resulting in a recommendation. The dataflow is widely dispersed, so all kind of news channels are covered, including interest based email alerts that point to other sources. This leads to countless website visits and reading something here and there. When writing the report you remember reading a little bit about a new technology or a takeover rumor, but forgot what and where. Unfortunately there is no way of finding it again. Is there an elegant way to prevent this loss of information from happening?

What would be your choices in such a work environment?

  • Ignore all the news flows and make up your own mind
  • Focus on a few ‘un-biased’ sources
  • Take it all and see how far you come

There are others but they all sound far from ideal.

Wouldn’t it be cool to copy and paste a few interesting parts of text from a website while reading it, and save those snippets to a large sketch document in Word. At the end of the week you can compose a short report out of the snippets in the document. This would reduce situations where you encounter questions about the report and you knew reading it somewhere but forgot where or if it had any relevance.

Building the solution
What we need is Word, a little VBA and IE5.5 + as the browser to read the news.

In the VBA editor of Word, add two COM references through the tools menu

  1. Microsoft HTML Object Library
  2. Microsoft Internet Controls

This looks like

References

  1. Next add a UserForm to the project and this will be our floating form.
  2. On the form add two commandbuttons and a listbox.
  3. The listbox is loaded with text items of interest at startup of the form

Application Form

When you open up a fresh IE browser window and find something of relevance related to one of your listed items take the following steps:

  1. Select the text you need to store
  2. Select the item in your list
  3. Click the [grab text] button

this looks like

Form in action
The text will be saved to the document of interest bearing the same name as the selected item in the listbox. The code includes a bit of logic and error checking and you can easily adapt this code to suit your own needs. After experimenting a bit in Excel I ported this solution to VB and will include this in a private .NET project containing several other specific “work-enhancing” goodies.

Conclusion
We started with an annoyance in our normal workday routine due to information overload, but got a long way in solving it. Using VBA and some handy VB API calls like checking for a folder and if it did not exist create one, or code to get the selected text in an IE window. In this post Word was used to store the snippets, but of course this could be expanded to MS Access depending on the need.

Tools to automate manual tasks can reduce part of our workload and they can be right under our nose like the MS Office Applications and their VBA environment. Of course this is a rudimentary example and you could think of more sophisticated information scanners or collectors. AI and DM techniques can be implemented to search for patterns in our information collecting behavior. Based on this analysis of behavior you can implement a sort of “info-collector bot” an idea already used in some of the blackbox trading systems used in the ever creative financial world.

The download Sample Document zip contains a Word document that includes all code and a sample set of items. All comments are welcome as I’m here to share and learn.

Good luck!

Sample document

Sources:
VB code for the folder check
References to retrieve the selected text from a webbrowser

Posted in Office (All), VBA, Word | 2 Comments »