Instance still running

sharky12345

Well-known Member
Joined
Aug 5, 2010
Messages
3,380
Office Version
  1. 2016
Platform
  1. Windows
Can anyone tell me why this still leaves an instance of Excel running;

Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Workbook_BeforeClose
' Runs when the workbook is closed.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim WS As Worksheet
Dim RowNum As Long
Dim EndRow As Long
Dim LastDel As Long
Dim FirstDel As Long
Application.ShowChartTipNames = True
Application.ScreenUpdating = False
Set WS = Worksheets("AUDIT")
With WS
RowNum = .Cells(.Rows.Count, CLOSE_TIME_COL).End(xlUp).Row + 1
.Cells(RowNum, CLOSE_TIME_COL).Value = Now
.Cells(RowNum, CLOSE_WB_NAME_COL).Value = ThisWorkbook.FullName
.UsedRange.Columns.AutoFit
If KEEP_ONLY_LAST_N_ENTRIES > 0 Then
EndRow = .Cells(.Rows.Count, USERNAME_COL).End(xlUp).Row
If EndRow > 2 Then
FirstDel = 2
LastDel = EndRow - KEEP_ONLY_LAST_N_ENTRIES
If LastDel > 2 Then
.Cells(FirstDel, "A").Resize(LastDel - 1, 1).Select
End If
End If
End If
End With
Application.ScreenUpdating = True
Sheet4.Visible = xlSheetVisible
Worksheets("Correspondence").Visible = xlSheetHidden
Worksheets("AUDIT").Visible = xlSheetHidden
Worksheets("LOGS").Visible = xlSheetHidden
Worksheets("Charts").Visible = xlSheetHidden
Worksheets("SETUP").Visible = xlSheetHidden
Sheet4.Activate
ActiveWorkbook.Close savechanges:=True
End Sub
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

sharky12345

Well-known Member
Joined
Aug 5, 2010
Messages
3,380
Office Version
  1. 2016
Platform
  1. Windows
VoG, thanks - will that close all instances or just the relevant one?
 
Upvote 0

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
I'm pretty sure it will close only the relevant one but you'll need to test!
 
Upvote 0

sharky12345

Well-known Member
Joined
Aug 5, 2010
Messages
3,380
Office Version
  1. 2016
Platform
  1. Windows
Tried it, it does the whole lot - this isn't a major issue for me though.
 
Upvote 0

Forum statistics

Threads
1,195,745
Messages
6,011,401
Members
441,613
Latest member
worksux

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top