Found where program stops, but can't stop it stopping !!

Found where program stops, but can't stop it stopping !!

Post by Whythe » Fri, 11 Sep 2009 22:29:26


Hello All,

I've previously asked about finding where my long program is stopping.
I've used several Debug.print lines in the code to find where this is
happening..........and it stops just after the line following 1By.....

With Application
.EnableEvents = False
.ScreenUpdating = True
.Calculation = xlCalculationManual
Debug.Print "1Bx" '++++++++
ChDir "R:\Statistics\"
Debug.Print "1By" '++++++++
.Workbooks.Open "R:
\Statistics\book" & xxx & ".xlsx", False, , , , True
Debug.Print "1Bz" '++++++++

.Calculation =
xlCalculationAutomatic
.ScreenUpdating = False
.EnableEvents = True
End With

It loops through the above about 40 times, opening different books -
it doesn't always stop when trying to open the same workbook. Since
finding the problem I've added in the methods (.EnableEvents =
False / .ScreenUpdating = True / .Calculation = xlCalculationManual)
to try to sort things out but it is still occuring.

All the above happens in a second instance of Excel.

Any help much appreciated

Regards,
Jason.
 
 
 

Found where program stops, but can't stop it stopping !!

Post by Peter » Sat, 12 Sep 2009 00:00:46

What do you mean by "stopping", does code break on a line of code, or does
Excel crash, etc
You say "it all happens in a second instance", looks like your code is
attempting to open workbooks in the same instance, show us your automation
code.

Difficult to comment with the information given.

Regards,
Peter T



Try and explain what you are doing,