Focus problem??

J

JeremyJ

Excel tends to freeze up sometimes when I open, close and switch between two
Excel Documents. One is referenced by the other. I think this problem has
to do with focus. How can I prevent these freezes?
 
J

JLGWhiz

I am not so sure it is a Focus problem. If the workbooks are linked with one
open and the other closed, and you have code in the workbook open that causes
a calculation process that relies on the still closed workbook, then it could
be causing copiler problems. You might need an If ... Then statement in
your workbook open that evaluates whether the other workbook is open and, if
not, bypass any code that would cause calculation to occur. Of course, I am
only guessing what the problem may be, but if it is what I described, then
you could check for the other workbook being open like this, where
Workbooks("B.xls") would be your other workbook:

Private Sub Workbook_Open()
If Workbooks("B.xls") If Nothing Then
Exit Sub
Else
'Run existing code
End If
End Sub
 
J

JeremyJ

Thanks for the reply. It will freexe when I first run a macro from Workbook
"A" directly after closing Workbook "B" even if the macro from Workbook "A"
doesn't have anything to do with Workbook "B".

I believe that is what you were talking about.

Is it possible that something is still in memory from the closed Workbook
(like objects) that could be interferring? Just a guess....

Any ideas???
 
J

JLGWhiz

Jeremy, it is really difficult to offer meaningful advice because there is no
way to evaluate the symptoms without seeing what is actually in your workbook
code modules. It sounds like you might have some event code in the workbook
that is the culprit but without being able to see what actually happens and
review the different procedures, it is only guessing. It could be anything
from corrupted file to perpetual loop that gives the appearance of freezing
up. But as I said, it sounds like some event code that is the initiator of
the problem.
 
J

JeremyJ

I wouldn't know which modules to show. It "freezes" on many of them. Both on
events and other modules that don't trigger events. I hope the file isn't
corupted. I don't how to check for that.

I think you are correct though that it only gives the appearance of
freezing. When I say freeze I mean that the mouse has no affect on the
application other than the 3 buttons in the upper right hand corner
("Minimize", Maximize" & "Close"). I am able to run some modules from the
VBA Application. While it is "frozen" I can reference a range and show it's
value in a msgbox.

Does that give any clues? I wish I could explain it better. Thank you for
any helps.
 

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