ActiveWorkbook.Close upon closing book it opens a blank excel book

0 Agios

Well-known Member
Joined
Feb 22, 2004
Messages
570
Office Version
  1. 365
here is the code

ActiveSheet.Protect Password:="7863396789", DrawingObjects:=True, Contents:=True, Scenarios:=True _


ActiveSheet.EnableSelection = xlUnlockedCells
Unload Me
ActiveWorkbook.Save
ActiveWorkbook.Close
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
are you sure you did not already have a blank sheet created and it has just reappeared? (eg you copied a sheet to a new book)
 
Upvote 0
I was wrong. This is what happens. No matter what i do, if i have other workbooks open it closes them also.
here is the code i tried

Private Sub CommandButton35_Click()
' ActiveSheet.Protect Password:="7863396789", DrawingObjects:=True, Contents:=True, Scenarios:=True _


'ActiveSheet.EnableSelection = xlUnlockedCells

'ActiveWorkbook.Save
Workbooks("Bid Schedule.xlsm").Close SaveChanges:=True
'ActiveWorkbook.Close
' Unload Me
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,357
Messages
6,124,483
Members
449,165
Latest member
ChipDude83

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
Back
Top