ThisWorkbook.Close crashing Excel (2010)
"Michel D" wrote in message
...
Hi Clif,
If my code is...
Sub byebye()
Activeworkbook.close False
End Sub
And that I have an Option button on a sheet that is linked to this
macro, I don't understand how to integrate this workaround into my
workbbook using the OnTime Now option.
Did you see my reply on 10/16 evening explaining the mechanism to
integrate the workaround?
Also, I need to point out that I did some testing and found that if I
link the code to a standard grey macro button, It works fine BUT just
one time. The second time I try to run the code it crashes.
It would help us help you if you could explain more about what you are
wishing to accomplish. Your explanation so far gives us a bit about
"what" you are doing but doesn't give any insight about "why". It may
be that a different approach would serve you better.
For instance: I have a workbook that is nothing more than a list of
other workbooks that I occasionally use. I found that it works well for
me to create a toolbar macro to open my cross-refrence workbook, then
double-click on the workbook I want to open rather than using Windows
Explorer, or File Open. This cross-reference workbook contains
Double-Click event code to open the workbook of interest, then close
itself.
So .. I have code running within a workbook that opens a different
workbook, then closes itself.
From your description (when working in workbook A the user opens
workbook B, then later clicks a button to close workbook B) I wonder if
Workbooks("b.xls").Close False
(or prehaps:)
Dim strBookName as String
strBookName = "b.xls"
Workbooks(xtrBookName).Close False
would work better for you.
NOTE: My workbook in question was created in EXCEL XP. and now with
EXCEL 2010, It crashes.
For me, it didn't matter if I used a workbook created in xl2003 or
xl2010, the code worked fine in xl2003 and always crashed in xl2010.
HTH!
--
Clif McIrvin
Change nomail.afraid.org to gmail.com to reply by email.
(nomail.afraid.org has been set up specifically for
use in usenet. Feel free to use it yourself.)
|