Found a macro, but don't know how to use it

  • Thread starter Thread starter lizator
  • Start date Start date
L

lizator

I need to import data from a .txt file to Excel - and to an existing
page in Excel. I tried for a bit, but then I realized that Excel
didn't have the feature. I found a good-looking macro on the web at
http://www.cpearson.com/excel/imptext.htm, but I'm not sure how to use
it. Can someone out there give me a hand?
 
Open Excel.

Open a blank workbook.

Open the VBA editor (Alt+F11).

Open or set focus to the Project Explorer (Ctrl+R).

Right-click on the VBProject node on the project tree that corresponds with
the blank workbook. (The module belonging to the active worksheet will
probably be highlighted.)

Select Insert->Module.

Copy the three procedures.
ImportTextFile
DoTheImport
ImportTextLines

Paste the code into the new module.

Save your work.

Return to the worksheet.

Press Alt+F8 (or otherwise open the Macros dialog).

Call DoTheImport or ImportTextLines, according to your preference, from the
Macros dialog.
 
Back
Top