VBA Stops Working?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello:

Excel 2003. I've noticed with some of my workbooks, particularly if I've
been working with them for a while, sometimes the code in the workbook will
not execute. For example, If I have a button or cell-change macro
programmed, sometimes the code will not execute if I click the button or
change the cell.

When I close Excel and re-open the workbook, it works fine.

Has anyone else noticed this? (Maybe you can point me to a knowledge base
article or something. I didn't see one.)

Thanks in advance,
MARTY
 
One possibility is that some code executes a
Application.EnableEvents=False but not the complementary =True.

Does your code start working if you switch to the VBE, open the
Immediate Pane (CTRL g), type Application.EnableEvents=True and press
ENTER?

Of course, in the Immediate pane you could also check the setting of
EnableEvents with ?Application.EnableEvents

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
 
As a guess are you turning events on and off in your code. If for some reason
there is a leak some where you may be turning events off without turning them
back on again. To check this next time it happens manually run this code to
see if the problem is fixed.

public sub ResetEvents
application.enableevents = true
end sub

That's my best guess.
HTH
 
Thanks Jim.

If I'm turning events on and off I'm not doing it intentionally. I have no
..EnableEvents code in my procedures. Nevertheless, thanks for the
suggestion. I'll try it.

I'm still puzzled as to why it's happening though.
 
Hi, Tushar:

Thanks for the response. See my response to Jim Thomlinson in this thread.
You and he had the same thought on this matter.
 

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

Back
Top