VBA (excel) quits on workbooks.open
Hi Nick,
With this simple test I couldn't replicate your problem
Dim msName$, msFullname$
Sub StoreFileName()
'ActiveWorkbook is a previously saved wb
msFullname = ActiveWorkbook.FullName
msName = ActiveWorkbook.Name
End Sub
' manually close the activeworkbook
Sub OpenLastFile()
'Workbooks(msName).Close False
Workbooks.Open msFullname
MsgBox ActiveWorkbook.Name
End Sub
OpenLastFile runs to the end, whether the file had been closed manually or
with the close line uncommented.
Code that just suddenly stops with no trappable error can be due to the
project recompiling for some reason. Code can also just stop due to an
unhandled error in a UDF particularly in xl97 but that's obviously not what
you have.
Regards,
Peter T
"Nicholas Dreyer" wrote in message
...
I have an ellaborate VBA project that does of most of any needed
openening and closing of workbooks. I am trying to make it so
everything remains under control when a user opens and closes
workbooks directly from excel.
Anyway, the details are to involved to get into now, but here is a
very strange symptom that happens if a workbook is closed directly
from excel and then opened from code within VBA:
Any statements after
workbooks.open <nameofworkbook_just_closed
never are executed.
What is particularly difficult in trying to debug this is that when
you step through the code using F8 key, the code does *not* quit on
the workbook.open, but continues to completion as intended.
Anybody ever seen this symptom and know what possible causes there
are? No need to suggest using On Error Goto 0. That has already been
done . . .
Thanks a-million for any suggestions.
Nick
|