This article will explain how you can organize a text file to make it easy to search for, and retrieve information.
Organizing The File
We'll use the example of using a text file containing a code library, where you can store individual procedures for later use.
One way to search the file is to place your own tags around the code, so that your own VBA code can find the block of text and do something with it. In this case, the "tags" are already in place with the sub and end sub lines.
Perhaps your text file looks something like the text below and you want to retrieve the changeMe procedure which changes the color, bold and font type of the selected cell.
Sub firstCodeSnippet() ' other subs end subSub changeMe(cellAdress) Range(cellAddress).Select With Selection.Font .Name = "Tahoma" .Bold = True .ColorIndex = 3 End With End sub
Sub otherCodeSnippets() ' other subs end sub
Now, you just need to write some VBA code to retrieve the data.