© Matti Mattila, CPFA, CISA, CIA

Text File Import Macro #4 (ImpAny)

Previous item Next Item Previous menu
Revised 10.5.2011
Purpose of the macro
The macro is esentially much improved version of 'TextImport' macro #2. 'ImpAny' is able to import ANY text file (source file) or selected lines of it to MS Excel (Excel) or to a new text file. In addition (1) it is able to make differenrce with uppercase and lowercase letters in filters and (2) it has functionality to make extended lines (records), i.e. lines containing additional information compared to that existing in the text file subject to import (source file).
Macro's functionality
- The macro imports lines of any text file Excel worksheet or to a new text file. Lines of a source file can freely vary in length.
- You can have original order number in front of each line of the source file. Original order number in useful e.g. in identifying location of an imported line in the source file, and in re-arranging lines according to natural order.
- You can use one criterion or more criteria (among others filters) in order to import only lines of interest. Using this functionality you can limit import e.g. to those log file lines that begin with certain strings or that are within certain position range on the line.
- You can make the macro add after each imported line [of a source file] the filter value that was matched as a condition to import the line in question. This information can prove very useful when making in analyses. Among other things it is a quicker and more convenient solution to a problem here.
- In stead of importing a text file to Excel you can import it to a new text file. This may prove practical in e.g. in the following cases:
(1) the line lenght is more than 255 [1]; or
(2) the lines of source file vary, and you want to make lines [2] to same fixed lenght with 'TexEdi1', before importing - and in order to import - [selected] source file lines to Excel with 'ImpFix'.
Download
You can download a demo macro (xl07c4D.zip) here. It will import a limited number of text file lines to Excel. See here how to get a full version of 'ImpAny1' macro.
An updated demo version of the macro ('ImpAny') is a part of demo of 'ExcAud' macro set. You can dowload demo version of 'ExcAud' here.

[1] When count of characters in a cell exceeds 255 Excel is not able to show the contents of a cell; you are shown "########..#".
[2] Lines imported can become varying in lenght when you want macro to add the [sting match] filter value after a line, and the filter value varies in lenght.
Details

Basic Import
22.06.2010; 14.03.2011 Advanced Import
20.07.2010; 14.03.2011

'ImpAny' is one of the macros of ExcAud.