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

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
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?
 
Upvote 0

Forum statistics

Threads
1,223,237
Messages
6,170,928
Members
452,366
Latest member
TePunaBloke

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