ActiveWorkbook.Close SaveChanges:=True Not Working???

DaveHappyNorm

New Member
Joined
Jul 22, 2018
Messages
15
Hello all

I have written a macro that does various things on a workbook.

The Workbook is then saved and closed using the command ActiveWorkbook.Close SaveChanges:=True
this command was working fine until I made various changes but now it now longer works.

The last bits of my macro is as follows:-


Range(Cells(22, L), Cells(33, L)).Select
Selection.Copy
Cells(22, L).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False

ActiveWorkbook.Close SaveChanges:=True

The last line of code is ActiveWorkbook.Close SaveChanges:=True which does not work, I have tried F8 but it selects the line of code and then moves to the next line of code without closing the workbook.

What would prevent the command ActiveWorkbook.Close SaveChanges:=True to not save and close the active workbook?

Can anyone help?

Thank you.
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

JoeMo

MrExcel MVP
Joined
May 26, 2009
Messages
17,461
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Do you have any event code in the active workbook? In particular, anything in ThisWorkbook like:
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Cancel = True
End Sub
which would cancel every request to close the workbook?
 

Forum statistics

Threads
1,136,303
Messages
5,674,971
Members
419,537
Latest member
ucatchy

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