View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dave Unger Dave Unger is offline
external usenet poster
 
Posts: 153
Default Workbook.close & beforeclose

Hello,

I’ve searched the groups, but can’t seem to find anything that quite
addresses this, hoping someone can tell me where I’m going wrong.

I have the following code in the BeforeClose event :

Private Sub Workbook_BeforeClose(Cancel As Boolean)

Dim wk As Worksheet

For Each wk In ThisWorkbook.Worksheets
wk.Visible = xlSheetVisible
Next wk

End Sub

When I close the workbook manually, it works as expected. But if I
run
“ThisWorkbook.Close savechanges:=False” from a procedure, it doesn’t.