Home |
Search |
Today's Posts |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Oct 18, 11:49*am, "Clif McIrvin"
wrote: RePost ... it seems that OP is not seeing my replies ... on investigation it appears that OP is posting via eggheadcafe -- and my replies aren't showing up in the original thread. ???!@* Clif (I changed the subject back to it's original to keep the topic "up front", so to speak. *"I have the same problem too" doesn't really supply useful information, especially for someone who sees the message standing on its own, without the benefit of the context of the preceeding messages in the thread. In fact, I'd never have read your first post if my newsreader hadn't connected it to the original thread in spite of your changing the subject line.) Michel, you use a couple terms that I'm not sure how to interpret. When you say "Option Button" (in quotes), and "regular grey macro button" I'm not at all certain what you mean. Let's clarify: *I understand that your sub Hello is in a standard module of workbook "a.xls" and Byebye is in a standard module of workbook "b.xls" (by standard module I mean a code module that the VBE project explorer window shows under the heading "Modules", not "ExcelObjects", or "Forms".) To integrate Jim Rech's solution, add another subroutine to the standard module in b.xls: Sub GoByebye() * * Application.OnTime Now, "Byebye" End Sub and change your macro button to point to GoByebye instead of Byebye. HTH! Clif "Michel Demers" wrote in message ... Hi Clif, You have me in a loop. Perhaps it is because I'm more of a beginner in VBA, but I can't find a way to integrate your solution. *So this is my situation... When running a simple code such as From Workbook "A.xls" Sub Hello() * * Workbooks.Open Filename:="d:\B.xls", UpdateLinks:=0, ReadOnly:=True End Sub And From "B.xls" Sub Byebye()ThisWorkbook.CloseFalse End Sub The "Hello" code works just fine, and when I run the "Byebye" code Via the VBA Editor either using F5 or F8, it works fine too. *But I have an "Option Button" on a sheet that has the "byebye" macro assigned to it in order to close the "B.xls" workbook. Now here is a twist... I've replace the "option button" with a regular grey 'macro button" and assigned the macro to it. *It works fine ONE TIME ONLY. If I run it a second time, it crashes. Now is that weird ??? So can you offer me a more "step-by-step" as to how to resolve this work around solution !!! Curent system setup WindowsXP SP3 Office XP (2002) SP 3 And also Office2010version 14.0.4760.1000 (32 bits) Your help would be so appreciated Best regards, Michel On Oct 14, 10:17 am, "Clif McIrvin" wrote: "Michel D" wrote in message ... Any news from Chad Rothschiller at Microsoft? Well, yes and no. Turns out this bug goes back as far asExcel 2003 at least, maybe more, and we haven't fixed it yet (probably because we're not sure anyone cares for "real" reasons). I'll inquire and see if I can learn if they assigned a tracking ID or anything; I'm simply using the workaround suggested by Jim Rech (below, ) of using Application.OnTime to move theThisWorkbook.Closecommand out of the running procedure. I have encountered two cases whereExcelcrashes, and Jim's workaround succeeds: -- DoubleClick or RightClick event code executingThisWorkbook.Close -- DoubleClick or RightClick event code executing sheetObject.Activate, where the sheetObject is in a different workbook. I found it interesting that though they said the bug exists in xl2003 my code ran fine then. Clif On Tuesday, September 21,20107:42 PM Clif McIrvin wrote: <snip Initial testing shows that macro code is doing what I expect, until "ThisWorkbook.Close", which (so far) always results in the MicrosoftExcelhas encountered a problem and needs to close. We are sorry for the inconvenience. (etc.) <snip On Thursday, September 23,20106:54 AM Jim Rech wrote: Target As Range, Cancel As Boolean) ThisWorkbook.Close End Sub Same here. If you want a workaround I'd put in a delay, and kill the popup menu: Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean) Cancel = True Application.OnTime Now, "CloseMe" End Sub and in a standard module: Sub CloseMe() ThisWorkbook.Close End Sub -- 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.) -- 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.)- Hide quoted text - - Show quoted text - Well Clif, The workaround seems to work. Thank you Clif for your patience... |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
ThisWorkbook.Close question | Excel Programming | |||
Excel crashing when trying to close a workbook | Excel Programming | |||
Excel crashing intermittently on save or file close - caused by vba? | Excel Programming | |||
ThisWorkbook.close doesn't wokk :( | Excel Programming |