View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
JLatham JLatham is offline
external usenet poster
 
Posts: 3,365
Default How to read text from a non-delimited text file?

As for putting the information into a new workbook, that's easily done also.
Look for information in Help on
Workbooks and the .Add, .Save and .SaveAs methods. Look around for
information on selecting sheets and putting values into sheet cells here in
the forums - there are tons of discussions about it.

I'll give you a heads up, when you use the Workbooks.Add command, at that
point you are "in" the new workbook - it becomes the active one. You still
have reference to all the variables and objects in the original workbook, it
still exists, and is still open.

"Phil" wrote:

I would like to use a macro to read in text from a text file that is
not delimited and store the data in variables. For example, from line
5 of the text file I want to read from column 7 to 17 and store that
value in a variable. After reading in values from various places in
the file, I will do some calculations using these numbers, then create
a new Excel file and write the calculated numbers into the new file.

Is there a way to do this in VBA?