By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,320 Members | 1,596 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,320 IT Pros & Developers. It's quick & easy.

Excel Solver macro from VB.NET

P: n/a
I'm trying to run a Excel macro, which uses SOLVER.XLA Add-In, in
VB.NET application. When the macro is executed I get the following
error message

"Solver: An unexpected internal error occured, or
available memeory was exhausted"

Any suggestions whats causing this error and how to debug it???

Also, I get the following exception message when executing all the
macros from the excel sheet

"Exception from HRESULT: 0x800xxxxx"

I'm not sure about the source of this either.

Can anyone pls help me with these errors?? :)

My code for reference:

Dim oExcel As Excel.Application
Dim oBook As Excel.Workbook
Dim oBooks As Excel.Workbooks
Dim oSheets As Excel.Sheets
Dim oSheet As Excel.Worksheet

oExcel = CreateObject("Excel.Application")

oBooks = oExcel.Workbooks

oBook =
oBooks.Open("C:\Inetpub\wwwroot\PrePackOptimizer\D ata

oExcel.AddIns.Add("C:\Program Files\Microsoft

oExcel.DisplayAlerts = True


P.s.: The macro and the SOLVER runs perfectly when run from the EXCEL

Dec 16 '05 #1
Share this Question
Share on Google+
3 Replies

P: n/a
this errors seems of memory leaks. when u run the managed code it runs
in its app domain. so the meory alloted by CLR is not enough to run the
code. if is there any way you can process the excel file in a divided
groups of data than you may not get error.

this could be one of the reason.

Dec 16 '05 #2

P: n/a

Are you sure that the methode were the code is running in is not goin enless
recursive (repeated).

That is hard to debug, because the debugger does not show that standard.

However that is mostly the reason for going out of memory.

Just a thought,

Dec 16 '05 #3

P: n/a
Thanx Lucky,

I've found the reason for the error, thanx to It seems the Solver.XLA needs to be
explicitly opened before it can be used. This is done automatically
when we open the excel manually, but when we use objects, we have to
open it using the following command


Once this was done my application started working as


Dec 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.