Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Problem: Closing one book causes the 2nd book freeze

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy worksheets to new book without linking to original book Lori Excel Discussion (Misc queries) 2 March 4th 09 04:46 PM
'BeforeClose' code problems:book won't close if more than one book is open Ed from AZ Excel Programming 0 September 18th 07 03:59 PM
No need of save change confirmation at closing book Shariq Excel Discussion (Misc queries) 3 January 10th 07 09:26 PM
auto closing a work book myssieh Excel Programming 1 August 25th 05 05:19 PM
Open book, check for macros, close book Robin Hammond[_2_] Excel Programming 5 March 31st 05 06:09 PM


All times are GMT +1. The time now is 10:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"