Try some code like the following:
Sub AAA()
Dim FName As Variant
Dim FNum As Integer
Dim LineRead As String
Dim R As Range
Set R = ActiveSheet.Range("A1") '<<< CHANGE START CELL
FName = Application.GetOpenFilename( _
"Text Files (*.txt;*.raw),*.txt;*.raw")
If FName = False Then
' no file selected
Exit Sub
End If
FNum = FreeFile()
Open FName For Input Access Read As #FNum
Do Until EOF(FNum)
Line Input #FNum, LineRead
R.Value = LineRead
Set R = R(2, 1)
Loop
Close #FNum
End Sub
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
On Fri, 31 Oct 2008 08:45:00 -0700, Boris
wrote:
All,
I would like to write a Macro that does the following:
1. Opens an ASCII file (e.g. a *.txt or *.raw file)
2. Copies the data from the ASCII file into the Excel file.
Every line from the ASCII line should be inserted into a new row
3. closes the file
Could someone tell me how to do this?
Best,