I’m trying to import data from an external file using VBA so I don’t need to be here 24/7.
No problem with the smaller files but I’m hitting a compile error: Out of memory when I try to specify more than say 36 array elements.
Here’s a section of the code:
Workbooks.OpenText FileName:= _
MyfileName _
, Origin:=xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier _
:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:= _
False, Comma:=False, Space:=False, Other:=True, OtherChar:=”|”, _
FieldInfo:=Array(Array(1, 1), Array(2, 2), Array(3, 2), Array(4, 2), Array(5, 2), Array _
(6, 2), Array(7, 2), Array(8, 2), Array(9, 2), Array(10, 2), Array(11, 2), Array(12, 2), _
Array(13, 2), Array(14, 2), Array(15, 2), Array(16, 1), Array(17, 4), Array(18, 4), Array( _
19, 4), Array(20, 1), Array(21, 1), Array(22, 1), Array(23, 1), Array(24, 1), Array(25, 1), _
Array(26, 1), Array(27, 1), Array(28, 1), Array(29, 1), Array(30, 1), Array(31, 1), Array( _
32, 1), Array(33, 1), Array(34, 1), Array(35, 2), Array(36, 1), Array(37, 2), Array(38, 2), _
Array(39, 1), Array(40, 1), Array(41, 1), Array(42, 1), Array(43, 2), Array(44, 1), Array( _
45, 1), Array(46, 2), Array(47, 2), Array(48, 2), Array(49, 2), Array(50, 2), Array(51, 2), _
Array(52, 2), Array(53, 2), Array(54, 2), Array(55, 1))
According to other info I have, the number of elements in the array shouldn’t be giving a problem, but it does.
I have no constants and 3 public dims.
The filename to open comes from GetOpenFilename sub in same module.
Any suggestions on how to open a file containing this number (or more when I have 72 columns to import) of csv fields??
TIA
Alan
Cheshire
UK