Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Stupid me.
I should NOT use Wb.Close in that situation. Thanks, Fred "fred" wrote in message ... Hello, My app is using Excel automation. I have 2 workbooks opened. When user wants to close one workbook my code catches that event asking for the confirmation. When permission granted then my app allows closing that workbook but after the closing the remaining workbook remains frozen (does not respond to the mouse click). Minimizing and restoring Excel clears that problem. What I am doing wrong? Below is the code: ============== Private Sub moExcelApp_WorkbookBeforeClose(ByVal Wb As Excel.Workbook, Cancel As Boolean) If Wb.Name = moExcelDNCWS.Parent.Name Then If moExcelDNCWS Is Nothing Then Exit Sub If MsgBox("Closing " & Wb.Name & " will disable DNC option." & vbCrLf & "Do you really want to close it?", vbQuestion + vbYesNo, App.Title) = vbYes Then Set moExcelDNCWS = Nothing Wb.Close Else Cancel = True End If End If End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
copy worksheets to new book without linking to original book | Excel Discussion (Misc queries) | |||
'BeforeClose' code problems:book won't close if more than one book is open | Excel Programming | |||
No need of save change confirmation at closing book | Excel Discussion (Misc queries) | |||
auto closing a work book | Excel Programming | |||
Open book, check for macros, close book | Excel Programming |