That "out of memory" error

J

john martin

I have read many references to the "out of memory" error posted here.
But my problem seems to be slightly different. It is not a chart/font
problem. Nor a multiple workbook or formula problem. Nor any of the
many other problems related to this error.

I am populating the cells in a new worksheet from a recordset. It is
just text that I am adding. The cell that is being populated is the
306th iteration of a loop. The text in the cell is reasonably large at
1600 characters, but there are many more cells earlier in the loop
that have similar or more characters (the largest being 2346
characters).

I have found that if I populate the Cell with the first 1024
characters it will work, but 1025 characters gives the same message.

I have checked task manager on the machine, and I am no where near
reaching the limits of available RAM, so it is not a system memory
problem (unless I have a memory leak). I have checked the
"Application.MemoryUsed" and I am no where near the internal Excel
stack maximum. I have tried sprinkling the code with ‘DoEvent's but
this makes no difference.

I am still googling, but does anyone have any suggestions?
 
K

K Dales

No solution but a verification of the issue, happened to
me just yesterday...

Have an Excel sheet that populates a section (merged cell)
with text comments from an Access database. I use VBA in
Access to open the spreadsheet and put the comments in the
cell. Works fine but with one record keeps giving me
the "Out of Memory" error - just checked and the
troublesome comments is 1102 characters long!
 
J

john martin

I've sorted it!

It seems that the recordset field in question started with a minus
sign, and it was this that was restricting the length of input. The
solution is painfully simple.

ws.Cells(i, 3).Value = "'" & Comment

Doh!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top