ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Focus problem?? (https://www.excelbanter.com/excel-programming/422619-focus-problem.html)

JeremyJ

Focus problem??
 
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?

JLGWhiz

Focus problem??
 
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


"JeremyJ" wrote:

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?


JeremyJ

Focus problem??
 
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???


"JLGWhiz" wrote:

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


"JeremyJ" wrote:

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?


JLGWhiz

Focus problem??
 
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.

"JeremyJ" wrote:

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???


"JLGWhiz" wrote:

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


"JeremyJ" wrote:

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?


JeremyJ

Focus problem??
 
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.


"JLGWhiz" wrote:

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.

"JeremyJ" wrote:

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???


"JLGWhiz" wrote:

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


"JeremyJ" wrote:

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?



All times are GMT +1. The time now is 11:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com