VBA-enabled Excel 2010 workbook will not close when any other workbook is open -


i have finished excel workbook utilizes fair amount of vba. spreadsheet able perform of intended functions, , there no issues when workbook open in excel. however, when other workbook open (unrelated files included), workbook not close. clicking on red "x" in top right corner not anything, , no error messages shown. in order close it, other excel windows must closed beforehand.

while not detract functionality of workbook itself, enough people using want avoid bringing inconvenience of having close other workbooks have open before being able close one.

so, have ideas causing happen? have code workbook_close() event, designated private , located within thisworkbook part of spreadsheet. i'm confused why sheet no vba involved prevents 1 closing. please let me know if there can clarify, thank you.

edit - here code workbook_beforeclose() event:

private sub workbook_beforeclose(cancel boolean)  if me.saved = false me.save call prepareworkbook  end sub  sub prepareworkbook()  application.screenupdating = false call unprotectworkbook  dim mastersheet worksheet set mastersheet = activeworkbook.worksheets("planning")  each sheet in activeworkbook.worksheets     if not (sheet.name = "readme" or sheet.name = "planning" or sheet.name = "prev")         sheet.visible = xlsheetveryhidden     end if     if (sheet.name = "readme" or sheet.name = "planning" or sheet.name = "prev" or sheet.name = "admin")         call protectsheet(activeworkbook.worksheets(sheet.name))     else         call protectplannersheet(activeworkbook.worksheets(sheet.name))     end if next  if activeworkbook.activesheet.name <> "planning"     mastersheet.select end if  call protectworkbook  application.screenupdating = true  end sub 

i should note commenting out call prepareworkbook() within workbook_beforeclose() event did not solve problem.

sounds doing workbook "editing cell" preventing closing (other things having formatting popup open this).

trying selecting workbook, pressing esc, , manually closing it. if works place in code "editing cell" or similar.


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -