Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default "Out of Memory" when import text file

I create a Excel Macro using array to import a large text file (man
columns) into a workbook. It come out as out of memory immediately.

I search around in the Internet and found many articles (especiall
from Microsoft) regarding this problem. The articles mention about th
fix memory allocation by Excel itself (not depending to the physica
memory).

I need to import the file into the workbook for the User to edi
certain field. Is there any other way to bypass this limitation o
other methods without using array?

The codes like shown below:

Workbooks.OpenText FileName:= _

"C:\WINDOWS\Desktop\ITIS_V1\DataInterfaceFile20030 911025232078.txt"
Origin:= _
xlWindows, StartRow:=1, DataType:=xlFixedWidth
FieldInfo:=Array(Array(0, _
1), Array(42, 1), Array(43, 1), Array(45, 1), Array(46, 1)
Array(51, 1), _
Array(58, 1), Array(65, 1), Array(73, 1), Array(78, 1)
Array(80, 1), Array(100, 1), Array( _
200, 1), Array(220, 1), Array(260, 1), Array(300, 1)
Array(340, 1), Array(360, 1), Array( _
365, 1), Array(450, 1), Array(452, 1), Array(465, 1)
Array(467, 1), Array(470, 1), Array( _
487, 1), Array(504, 1), Array(505, 1), Array(506, 1)
Array(507, 1), Array(508, 1), Array( _
509, 1), Array(569, 1), Array(629, 1), Array(638, 1)
Array(647, 1), Array(677, 1), Array( _
678, 1), Array(680, 1), Array(696, 1), Array(726, 1)
Array(746, 1), Array(747, 1), Array( _
776, 1), Array(806, 1), Array(836, 1), Array(866, 1)
Array(897, 1), Array(898, 1), Array( _
901, 1), Array(902, 1), Array( _
926, 1), Array(946, 1), Array(1146, 1)

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default "Out of Memory" when import text file

If there are field delimiters then use them instead.
Otherwise you try

Sub OpenBigFile(Optional fName As String _
= "C:\WINDOWS\Desktop\ITIS_V1" & _
"\DataInterfaceFile20030911025232078.txt")

Dim fId As Integer
Dim strInput As String
Dim myArray
Dim i As Integer
Dim rNo As Integer

myArray = Array(0, 42, 43, 45, 46, 51, 58, 65, 73, 78, _
80, 100, 200, 220, 260, 300, 340, 360, 365, 450, 452, _
465, 467, 470, 487, 504, 506, 507, 508, 509, 569, _
629, 638, 647, 677, 678, 680, 696, 726, 746, 747, _
776, 806, 836, 866, 897, 898, 901, 902, 926, 946, _
1146, 2000)


fId = FreeFile(0)
Open fName For Input As #fID
On Error GoTo errTrap
Workbooks.Add
rNo = 1

Line Input #fId, strInput
Do While Not EOF(fId)
For i = 1 To UBound(myArray)
Cells(rNo, i) = Mid(strInput, myArray(i - 1) + 1, _
myArray(i) - myArray(i - 1))
Next i
rNo = rNo + 1
Loop

closeFile:
On Error GoTo 0
Close #fId
Exit Sub

errTrap:
Resume closeFile
End Sub

(please excuse any errors, its Xmas eve here and code is
written untested - Merry Christmas to all!)

Kevin Beckham

-----Original Message-----
I create a Excel Macro using array to import a large text

file (many
columns) into a workbook. It come out as out of memory

immediately.

I search around in the Internet and found many articles

(especially
from Microsoft) regarding this problem. The articles

mention about the
fix memory allocation by Excel itself (not depending to

the physical
memory).

I need to import the file into the workbook for the User

to edit
certain field. Is there any other way to bypass this

limitation or
other methods without using array?

The codes like shown below:

Workbooks.OpenText FileName:= _

"C:\WINDOWS\Desktop\ITIS_V1

\DataInterfaceFile20030911025232078.txt",
Origin:= _
xlWindows, StartRow:=1, DataType:=xlFixedWidth,
FieldInfo:=Array(Array(0, _
1), Array(42, 1), Array(43, 1), Array(45, 1), Array(46,

1),
Array(51, 1), _
Array(58, 1), Array(65, 1), Array(73, 1), Array(78, 1),
Array(80, 1), Array(100, 1), Array( _
200, 1), Array(220, 1), Array(260, 1), Array(300, 1),
Array(340, 1), Array(360, 1), Array( _
365, 1), Array(450, 1), Array(452, 1), Array(465, 1),
Array(467, 1), Array(470, 1), Array( _
487, 1), Array(504, 1), Array(505, 1), Array(506, 1),
Array(507, 1), Array(508, 1), Array( _
509, 1), Array(569, 1), Array(629, 1), Array(638, 1),
Array(647, 1), Array(677, 1), Array( _
678, 1), Array(680, 1), Array(696, 1), Array(726, 1),
Array(746, 1), Array(747, 1), Array( _
776, 1), Array(806, 1), Array(836, 1), Array(866, 1),
Array(897, 1), Array(898, 1), Array( _
901, 1), Array(902, 1), Array( _
926, 1), Array(946, 1), Array(1146, 1))


---
Message posted from http://www.ExcelForum.com/

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default "Out of Memory" when import text file


http://support.microsoft.com/?kbid=134826
XL: "Out of Memory" Message Using the OpenText Method

Has work arounds.

--
Regards,
Tom Ogilvy

"kokyan" wrote in message
...
I create a Excel Macro using array to import a large text file (many
columns) into a workbook. It come out as out of memory immediately.

I search around in the Internet and found many articles (especially
from Microsoft) regarding this problem. The articles mention about the
fix memory allocation by Excel itself (not depending to the physical
memory).

I need to import the file into the workbook for the User to edit
certain field. Is there any other way to bypass this limitation or
other methods without using array?

The codes like shown below:

Workbooks.OpenText FileName:= _

"C:\WINDOWS\Desktop\ITIS_V1\DataInterfaceFile20030 911025232078.txt",
Origin:= _
xlWindows, StartRow:=1, DataType:=xlFixedWidth,
FieldInfo:=Array(Array(0, _
1), Array(42, 1), Array(43, 1), Array(45, 1), Array(46, 1),
Array(51, 1), _
Array(58, 1), Array(65, 1), Array(73, 1), Array(78, 1),
Array(80, 1), Array(100, 1), Array( _
200, 1), Array(220, 1), Array(260, 1), Array(300, 1),
Array(340, 1), Array(360, 1), Array( _
365, 1), Array(450, 1), Array(452, 1), Array(465, 1),
Array(467, 1), Array(470, 1), Array( _
487, 1), Array(504, 1), Array(505, 1), Array(506, 1),
Array(507, 1), Array(508, 1), Array( _
509, 1), Array(569, 1), Array(629, 1), Array(638, 1),
Array(647, 1), Array(677, 1), Array( _
678, 1), Array(680, 1), Array(696, 1), Array(726, 1),
Array(746, 1), Array(747, 1), Array( _
776, 1), Array(806, 1), Array(836, 1), Array(866, 1),
Array(897, 1), Array(898, 1), Array( _
901, 1), Array(902, 1), Array( _
926, 1), Array(946, 1), Array(1146, 1))


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default "Out of Memory" when import text file

:) Thanks Tom Ogilvy. The hiperlink given by you solved my problem

--
Message posted from http://www.ExcelForum.com

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
text string: "91E10" in csv file auto converts to: "9.10E+11" [email protected] Excel Discussion (Misc queries) 2 August 12th 08 03:13 PM
The Instruction at "0x749860a0" referenced memory at "0x00000000" Tribeca Excel Discussion (Misc queries) 1 July 5th 08 12:41 AM
Create an "import-friendly" text-file from excel? Mikael Lindqvist Excel Discussion (Misc queries) 3 January 9th 08 04:39 PM
.csv drops "0" when saved, even if file was set as "text". TRminator Excel Discussion (Misc queries) 3 November 2nd 05 02:11 PM
The instruction at "0x65255ac9" referenced memory at "0x00000008". The memory could not be read. Clikc OK to terminate etc Angus Comber[_2_] Excel Programming 1 November 7th 03 01:18 PM


All times are GMT +1. The time now is 10:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"