View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Kurt[_7_] Kurt[_7_] is offline
external usenet poster
 
Posts: 7
Default How to Use Chip Pearson's Text Import Code

Dim fname as String
Dim row as Integer, col as Integer
col = <the column containing the filenames ' A = 1, B = 2, etc.
For row = <startrow To <endrow
fname = Sheets(<sheetname).Cells(row,col).Value
do_your_stuff_here
Next row

wrote in message
ups.com...
I want to use Chip Pearson text import code from:
http://www.cpearson.com/excel/imptext.htm.

I see that I can feed the text file names to the subroutine by using
the code: ImportTextFile "c:\temp\test.txt", ";".

This is an easy programming question, but how do I feed the sub several
text file names derived from cells in a column, that don't have the
file extension ".txt" appended? I see that VBA is somewhat like
functions, but can I just say: ImportTextFiles ("h:\textfiles\" & D47 &
" "), " " to have it import a text file from the h:\textfiles\
Directory with the name of whatever the name is in cell D47 to the
active cell?