Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

create Excel object - "Not enough resources"

Status
Not open for further replies.

ccbryan

Programmer
Dec 31, 2013
8
US
Hello all... I am having some difficulty with Excel automation. Specifically, in a form method that is called from the click event of a button on the form, I have


Code:
lcFile = _outputpathAdm + thisform.cDistErr + ".XLS"
loExcel = Createobject("Excel.Application")

With loExcel
  .Workbooks.Open(lcfile)
  .Visible = .t.
Endwith
The problem is that when the code hits the "loExcel = Createobject("Excel.Application")" line, it blows up with the following error:

"OLE error code 0x80070008: Not enough storage is available to process this command"

That sounds straightforward, but there is plenty of space on all disks in use by this form, and this code works perfectly well on the same machine when run in a separate program. The error only occurs within the form.

Anybody seen this before or have any thoughts?

Chandler
 
I would expect this error only from line ".Workbooks.Open(lcFile)"

You could ensure which line the error is coming from by using
a) ASTACKINFO
b) ON ERROR with passing in LINENO(), LINENO(1), PROGRAM()...

Bye, Olaf.
 
Is it possible that you are not quitting Excel or releasing loExcel at the end of the method? If the user clicks on the button many times, you could end up with many instances of Excel running. I don't know if that would cause the error you are seeing, but it might be worth taking a moment to check.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
When you get enough instances of Excel in memory the error messages can get pretty weird.

When we first got VFP (and automation), I was experimenting with Excel one evening and things got weird so I decided to reboot. I got an error message saying "Not enough memory to quit" from Windows itself. [thumbsup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top