How to correct a 'fails to instantiate control'

L

lfriday

I create hundreds of similar documents using vba and a template that contains
3 combo boxes. In some files, the combo boxes appear to get corrupted,
evidenced by the bad file(s) opening in design mode. I finally got a message
inidicating a failure to instantiate control. Any help in understanding how
it occurs and/or how to repair or how to test or identify programmatically
would be appreciated.
 
P

Pesach Shelnitz

Hi,

I suspect that the VBA code in your template is not doing much to dispose of
unneeded objects and free up memory (to promote garbage collection). For
example, when your code is finished using an object that it creates by Dim
and Set statements, you should add the following line (in which myObject
should be changed to the actual name of your object) at the end of every Sub
for each object created in your VBA code.

Set myObject = Nothing

Of course, without seeing your code, it is difficult to be sure what the
problem is.
 

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