out of memory error

G

Gary Keramidas

i am getting intermittent out of memory errors in vba. it can happen when
hitting return in a module or running review source code from mztools. haven't
seen any other conditions yet.

i've attributed it to using a couple public variables.
Public wb2 As Workbook
Public wb3 As Workbook

i open each workbook in one module and from that module i call another module to
manipulate the data and then close the files and return to the calling module to
finish up. after running the code is when i get the error.

i tried this just to confirm it didn't happen:

i dimmed the 2 workbooks in each module.
i open the files in the first module and then use these lines to set the
variable after i call the 2nd module.
ActiveWindow.ActivatePrevious
Set wb2 = ActiveWorkbook
ActiveWindow.ActivatePrevious
Set wb3 = ActiveWorkbook

have never seen the error using this method.

anyone know why the public variables would be causing me a problem?
 
G

Gary Keramidas

tried it on another of my pc's, this one has 0ffice 2003 sp2 and it seems to
work fine. my main pc has office 2003 sp3 on it. this xp install has been
running for over 4 years, maybe it's time to reformat. it's been through quite a
few ms betas, too, so who knows what's going on.
 
J

JLGWhiz

Hi Gary, that memory thing usually happens when you have a series of
procedures that store variables without an intevening dump. Public variables
are not necessarily a cause but if you are stacking variables somewhere, it
will definitely eat up memory.
 
G

Gary Keramidas

thanks jl.

--


Gary


JLGWhiz said:
Hi Gary, that memory thing usually happens when you have a series of
procedures that store variables without an intevening dump. Public variables
are not necessarily a cause but if you are stacking variables somewhere, it
will definitely eat up memory.
 

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