Thread: Memory Leak
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Sakkie Sakkie is offline
external usenet poster
 
Posts: 4
Default Memory Leak

Thanx for the advice Nick. I finally got around to testing this. It
works, but it doesn't...

I open a new instance of Excel as suggested:

Set xlAppNewInstance = CreateObject("Excel.Application")

xlAppNewInstance.Visible = True

Then I open the file that uses the Add-Inn in the new instance:

xlAppNewInstance.Workbooks.Open (HourTemplateFile)

This works fine, now the next problem is the Add-In is not
automatically loaded in the new instance of Excel. I tried to open it
the same way I opened the workbook above:

xlAppNewInstance.Workbooks.Open (AddInFile)

This does not seem to work, no idea why, It does not make the functions
of the Add-In available. If I interrupt the VBA code here and in the
new instance of Excel manually open the file "AddInFile), the functions
are available and everything works fine if I allow the code to
continue.

Does all of this solve the "Memory leak" problem?
Interestingly enough, when the new instance of excel is closed, the
memory used is NOT returned; it is only freed when the procedure that
opened the new instance ends. Hmmm

Any ideas on how to get that Add-in to work without manually
interfering would be greatly appreciated.