Hello Dave,
Thanks for your reply. I tried text to columns but it did not work for
me.
For files which have less than 65536 rows, I use this macro to import
and it works wonderfully. Is there a way that this functionality can be
incorporated in the LargeImportFiles macro?
Public Sub ImportTextFile(FName As String)
Dim RowNdx As Integer
Dim ColNdx As Integer
Dim WholeLine As String
Dim Pos As Integer
Dim NextPos As Integer
Dim SaveColNdx As Integer
Application.ScreenUpdating = False
'On Error GoTo EndMacro:
SaveColNdx = ActiveCell.Column
RowNdx = ActiveCell.Row
Open FName For Input Access Read As #1
EndMacro:
On Error GoTo 0
Application.ScreenUpdating = True
Close #1
End Sub
Public Sub DoTheImport()
Dim FName As Variant
FName = Application.GetOpenFilename _
(filefilter:="Text Files(*.txt),*.txt,All Files (*.*),*.*")
If FName = False Then
MsgBox "You didn't select a file"
Exit Sub
End If
ImportTextFile CStr(FName)
Workbooks.OpenText FileName:= _
FName, Origin:=xlWindows, StartRow:=1, DataType:=xlFixedWidth,
FieldInfo:= _
Array(Array(0, 1), Array(10, 1), Array(21, 1), Array(29, 1),
Array(39, 1))
End Sub
> Do your import as normal, but then select that column and use
> Data|Text to columns
[quoted text clipped - 65 lines]
> > > Application.StatusBar = False
> > > End Sub
Dave Peterson - 07 Sep 2006 17:40 GMT
You could incorporate data|text to columns into your code that does the
importing, but you say it didn't work. (I've never seen it fail, though. If I
were you I'd try it again.)
Alternatively (and I think more work and slower) would be to parse the line when
you were reading it.
I'd try data|text to columns once more.
If it didn't work, share some more details.
> Hello Dave,
> Thanks for your reply. I tried text to columns but it did not work for
[quoted text clipped - 118 lines]
> >
> > Dave Peterson

Signature
Dave Peterson
dbahooker@hotmail.com - 09 Sep 2006 23:17 GMT
use a database; Excel is for f.cking retards and babies.
-Aaron
ADP Nationalist
> You could incorporate data|text to columns into your code that does the
> importing, but you say it didn't work. (I've never seen it fail, though. If I
[quoted text clipped - 129 lines]
> > >
> > > Dave Peterson